Subj : Re: Unique sets from {1..n} ? To : comp.programming From : Willem Date : Sat Jul 09 2005 12:06 pm TC wrote: ) Thanks, I will try that. I also saw another solution similar to what ) Willem mentioned: examine the bit pattern of a binary representation of ) each of the numbers 1 thru n. ITYM: 1 thru 2^n. Let's say n equals 3, then the 2^3 subsets are: { } { 3 } { 2 } { 2, 3 } { 1 } { 1 3 } { 1, 2 } { 1, 2, 3 } And the first eight binary numbers are: 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 Do these look similar ? Anyway, you'd do good to also work out a recursive solution, because that technique in general is applicalbe to different problems than the binary-pattern one, and knowing both is a Good Thing(tm). SaSW, Willem -- Disclaimer: I am in no way responsible for any of the statements made in the above text. For all I know I might be drugged or something.. No I'm not paranoid. You all think I'm paranoid, don't you ! #EOT .