wikipedia combinations, get an idea of the maths behind it. Then limit the size of the array to one chunk then 2 chunks etc etc

Chris