4 ms·
Whenever I encounter arbitrary precision libraries I want to try them out on extended Dudeney's digital century puzzle. This is from TAOCP 4A part 1: > Dudene
by knuthsat 6y ago
Whenever I encounter arbitrary precision libraries I want to try them out on extended Dudeney's digital century puzzle.
This is from TAOCP 4A part 1:
> Dudeney's Digital Century puzzle.) There are many curious ways to obtain
the number 100 by inserting arithmetical operators and possibly also parentheses into
the sequence 123456789. For example,
100 = 1 + 2 x 3 + 4 x 5 - 6 + 7 + 8 x 9 = (1 + 2 - 3 - 4 ) x (5-6-7-8-9) = ((1/((2 + 3)/4 - 5 + 6)) x 7 + 8) x 9.
Of course, instead of 100 we can put something else, add exponentiation, decimal point and an operator that reinterprets the number as if written in base X (12345_6789 = 2124962081444303 in base 10).
I also like how Knuth adds the number of possible trees in a grammar that generates these expressions without redundant parentheses :D