Subj : Re: combo numbering To : comp.programming From : bob Date : Thu Oct 06 2005 03:28 pm A 52bit number has 4.50359963 =D7 10^15 possibilities, which is way too high. I'm planning on storing an array of 133,784,560 32 bit numbers in memory, which takes up about 600 mb. This is on a machine that has only 768 MB of RAM. Ed Prochak wrote: > bob@coolgroups.com wrote: > > If you have 52 cards and you choose 7, there are 133,784,560 > > possibilities. > > > > So, let's say you have 7 playing cards. Is there an easy way to convert > > these cards into a number between 0 and 133,784,559? > > consider a 52bit number. > bit position 0 is ace of spades > bit position 1 is duece of spades > bit position 2 is 3 of spades ... etc. > > the 7card hand is a 52bit number with seven 1 bits. > > You could also use four 13bit numbers , one per suit. > that's easily just 4 ints. >=20 > HTH, > ed .