Live data from Hacker News

Powers of 2 with all even digits

oeis.org

121–123 of 123 posts

Re: Powers of 2 with all even digits

#121
I extended the search to all 2^n where n https://github.com/tdunning/EvenDigits

This uses much higher order sieves so that it runs about 32000 times faster than the naive algorithm and was able to search to this point on a single core. It is also possible to thread this algorithm relatively easily.

Re: Powers of 2 with all even digits

#122
post #103

Earlier quoted context omitted.

Is your algorithm published somewhere?

I literally just invented it, so it's not published yet, although I'll probably throw it up on GitHub at some point. It matches all published results up to an exponent of 3 billion or so, so I'm quite confident it's correct. The short explanation is that 2^x mod 10^k will repeat with a cycle length of 5^(k-1)*4. This is easily obtained from Euler's phi formula on 2^x mod 5^k, plus the fact that 2^x === 0 mod 2^k for…

That is basically the same algorithm I used. The sieve I used was only mod 10^15 but it sufficed to give the results at 10^13 in a few seconds and 10^15 in a few hours.

As mentioned in another comment, the code is at: https://github.com/tdunning/EvenDigits

Re: Powers of 2 with all even digits

#123
post #91

Earlier quoted context omitted.

10^10 * 36105/39062500 = 9242880, so you're already down to under 10^7 cases to check, which is starting to seem more tractable.

10^7 cases, but almost every case has billions of digits. Even that doesn't seem so bad though, it's on the order of 10^16 total digits to check in the worst case, and far fewer in practice. Maybe someone here can run a program overnight and increase the bound by another few orders of magnitude, or disprove the hypothesis?

You only need to check enough digits to find an odd one. An odd digit appears in the low order (< 46 up to a high level) digits for the first quadrillion cases so you only need to compute 2^n mod 10^d where d is big enough to be safe. I used d=60 in my computations to take this to 10^15 candidates (with no additional terms found).
Post reply on HN