Open mauro3 opened 3 years ago
In the Java code, there is an early bail-out when the intermediate sum exceeds the input number. This bailout does not occur in Julia, and not in some other languages either, and makes a big difference.
Furthermore
digit = thisnumber % 10
sumofpowers += power_of_digits[digit+1]
thisnumber ÷= 10
should use divrem
instead of first doing rem
and later div
, which is redundant.
I ran the https://github.com/JulesKouatchou/basic_language_comparison/blob/master/Julia/test_munchausen.jl script on my laptop and got times of 7s to 5s for Julia 0.6.4, 1.0 and 1.5. Thus the 100s on a Xenon-node seem off.