Factorial

I added factorial support to BigMath on my flight out to Seattle last week. I wanted to know how many possible permutations existed for a 3x3x3 Rubik's cube. I came up with 19.313 trillion (8! x 12!), but Wikipedia says there are 43 quintillion possible permutations. The Law of the Infallibility of Wikipedia proves that I'm obviously missing a dimension when I do my calculations. I'll have to put some more thought into it. Anyway, the factorial goodness is available now.

Update: I understand now. The dimension I wasn't considering was the three possible orientations for each corner piece and the two possible orientations for each edge piece. So, it should actually be (8! x 38) x (12! x 212). But it is actually less than that, but I don't yet fully understand it. I'll get there. Wikipedia says (8! x 38-1) x (12! x 212-1) / 2. Hmm. Here's an explanation that I haven't finished reading yet.

I added support for "static" instances of bignum_t for numbers 0..20. This should speed up a lot of things that now rely on allocating memory to hold a small value, only to deallocate it again very quickly. I'll have to go through all of the code and update it accordingly.

Subscribe to A garage sale for your mind

Don’t miss out on the latest posts. Sign up now to get access to the library of members-only posts.
[email protected]
Subscribe