_TITLE "How many hands of 13 from a deck" ' B+ started 2019-03-17
' How many hands of 13 from a deck?
' EDIT: formula for Combination of N items taken R at a time = N!/(R! * (N-R)!) so we need
' 52! / (39! * 13!) = 52 * 51 * 50 * 49 * ... * 40
' / 13 * 12 * 11 * ... * 1
a52_39(i) = 39 + i ' = 40, 41, 42, 43, ... 52 numerator multipliers
a13(i) = i ' 1, 2, 3, 4, ... 13 denominator multipliers
' To keep the numerator from getting too big reduce numerator terms by demoinator terms that divide evenly
'reduce terms in a52_39 by terms in denominator mult 2 to 13
found = 0
FOR j
= 1 TO 13 'is the array item divisible by i
' multiply whats left in numerator and denomiator
f~&& = 1: g = 1
f~&& = a52_39(i) * f~&& 'multiple numerators left
g = a13(i) * g 'multiply denominators left
PRINT "The number of hands of 13 in a deck is ";
PRINT " compare to 635,013,559,600"