|
How to Calculate a Keno Game Number
Each possible game can be assigned a value that defines what outcome actually took place. Game #1 would be (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20), game #2 would be (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,21), all the way to the final game number which would be (80,79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61) and would be called game #8,601,077,741,927,290,708,534,393,031,884,800,000. Note that the order that the balls came out in do matter, I am using permutations not combinations. I've developed a simple algorithm to assign a game # to each Keno outcome, and whenever a Keno game ends I do exactly that.
Please note that most programming languages cannot handle numbers as large as the numbers in the below formulas.
You can use bcmath in PHP, or BigInteger in Java, or you can write your own math functions that won't run as fast but mimic the way we use to do math with pencil and paper.
1) Take the value of the first ball and subtract 1
2) Multiply that number by 107,513,471,774,091,133,856,679,912,898,560,000
3) Take the rank of the second ball (so if the first ball was a 5 then 1 through 4 keep the same rank, and 6-80 all move up one rank to 5 through 79) minus 1
4) Multiply that number by 1,360,930,022,456,849,795,654,176,112,640,000 and add that to the number from step 2
5) Repeat steps 3 and 4 for the next 18 numbers using the following list as the multipliers:
a. 17,447,820,800,728,843,534,027,898,880,000
b. 226,595,075,334,140,825,117,245,440,000
c. 2,981,514,149,133,431,909,437,440,000
d. 39,753,521,988,445,758,792,499,200
e. 537,209,756,600,618,362,060,800
f. 7,359,037,761,652,306,329,600
g. 102,208,857,800,726,476,800
h. 1,439,561,377,475,020,800
i. 20,565,162,535,357,440
j. 298,045,833,845,760
k. 4,383,026,968,320
l. 65,418,312,960
m. 991,186,560
n. 15,249,024
o. 238,266
p. 3,782
q. 61
r. 1
6) Add 1
|