RE: Did Anyone Solve the MU-Puzzle in Chapter 1?
SPOILER ALERT. Mouseover this link to see my response.
Yes I think I did, but wikipedia says it’s impossible. I want someone to show me why my proof is wrong.
So either I’ve found a very strange coinciding bug into two completely different, well tested programming languages, or Wikipedia’s wrong, or more probably, I’m missing something.
WolframAlpha has the answer, and it says that you are wrong (twice)
That said, 32-bit Python and the UNIX utility bc both said the same as Erlang and Ruby. It seems to be an overflow issue, because 2^54 » 2^32, which is what I’m guessing your Erlang and Ruby interpreters are compiled as. (I’ll try this on 64-bit Python when I get a chance).64-bit Python says the same, however doing
2**54 % 3
returns 1, which means that, deep inside, it knows they’re not divisible.
Even with floating point representations, computers are quite inaccurate, and the fact that 2^54 is very close to being divisible by 3, as it were, isn’t helping. These kinds of operations usually require the use of BigNum libraries.
Certainly, this is one of those examples that show us how general purpose languages aren’t suited for accurate mathematical operations. It’s also indicative of how banks make lots of money from round-off errors, but that’s a different rant.
P.S. The math proof is simple, since any number that’s divisible by 3 would have 3 in its list of factors; 2^x only has 2s, so it’s not possible.