Discrete Mathematics

Bar-sized factorial

published on
What’s the first five digits of 1,000,000! or 1 million factorial? Let’s ask Haskell: Prelude> take 5 $ show $ product [1..1000000] "82639" (1043.56 secs, 1,444,511,743,624 bytes) Neat! But you might ask, how many digits is this rather large number, of 1 bar factorial? Let’s ask again: Prelude> length $ show $ product [1..1000000] 5565709 (1103.04 secs, 1,444,845,773,000 bytes) Wow! 5.5 million digits! Way more than all the electrons in the universe. Read More...

Permutations and combinations, and ways to calculate the number of draws in a lottery

published on
With a recent, unusually high Power Ball jackpot of ZAR ~220 million, we could not help discussing one’s chances for actually hitting the jackpot as a bit of nice office banter. Despite your personal take on the Power Ball and Lotto,� we can turn it into a nice mathematical puzzle, and sanatise the gambling aspect away. Yeah, we can do that, because we are into maths, programming and data! For the uninitiated among us, the way it works is simple really. Read More...