Iteration problem

I'm trying to work out a simple loop to produce the following results



/*
keywords = dray aerial COMPACT tailed

dray aerial compact tailed 0 1 2 3
dray aerial compact 0 1 2
dray aerial tailed 0 1 3
dray compact tailed 0 2 3
aerial compact tailed 1 2 3
dray aerial 0 1
dray compact 0 2
dray tailed 0 3
aerial compact 1 2
aerial tailed 1 3
compact tailed 2 3
dray 0
aerial 1
compact 2
tailed 3
*/


So something like:



n = length keywords

loop until something
{
keys = empty array

for ( i = 0 to n )
{
add to keys ( keywords[i] )
}
print keys

n = length keys - 1
}


but that's far from the right answer and hence this question :)


This question has also been asked under the SO section as it is for PHP and programmers are quite logical too http://stackoverflow.com/questions/14672108/simple-iteration-formula-for-php






via Recent Questions - Mathematics - Stack Exchange http://math.stackexchange.com/questions/293549/iteration-problem

0 comments: