# Combinations of values

**URL:** <https://forum.kirupa.com/t/combinations-of-values/206219>\
**Category:** Uncategorized\
**Created:** [November 6, 2006, 8:41am UTC](https://forum.kirupa.com/t/combinations-of-values/206219 "2006-11-06T08:41:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amaze](https://avatars.discourse-cdn.com/v4/letter/a/13edae/32.png) [@amaze](https://forum.kirupa.com/u/amaze)\
**Post date:** [November 6, 2006, 8:41am UTC](https://forum.kirupa.com/t/combinations-of-values/206219/1 "2006-11-06T08:41:55Z")

</div>

I think this one is a tough one, so I gave up trying after a couple of days.  
I hope you guys can help me.

Let’s say I got an array of x elements: [1,2,3,…,x]  
What I want is the combinations of (x-1), (x-2), …, 2 elements.

e.g. If x = 4, I want the following combinations:

123  
124  
134  
234  
(combinations of 3 elements)

12  
13  
14  
23  
24  
34  
(combinations of 2 elements)

Thanks all in advance! 😃
