Live data from Hacker News

Powers of 2 with all even digits

oeis.org

51–60 of 123 posts

Re: Powers of 2 with all even digits

#51
post #34
post #7

This is remarkable! I always find it fascinating that simple to express properties lack a proof. This is a very simple thing to evaluate and seems like it should be straightforward to establish that 2048 is the highest such power.

Everything about this seems so arbitrary. You look at the powers of an arbitrary number (here, 2), you pick an arbitrary base (here, 10) in which to express those powers, and ask for a random property of its digits (whether they belong to the set {0,2,4,6,8}). Nothing about this question feels natural. I've noticed that random facts often don't have simple proofs.

You can generalize it if you want. Given powers of p in base b, what is the largest n=p^i such that each digit is divisible by k. Here we have: if p=2, b=10, k=2, then n=2048 and i=11. Why? Maybe there is a deeper reason that applies to all values of p, b, k.

Re: Powers of 2 with all even digits

#54
post #53
post #52

Yeah, but how many powers of 2 have all odd digits?

0

> 0

2^0 is a power of two and has all odd digits.

Edit: If we include negative powers, there is also 2^-1, which is all odd except for the leading zero before the decimal point.

Re: Powers of 2 with all even digits

#56
post #48
post #42

Earlier quoted context omitted.

Here's a really dumb algorithm: for i in range(1, 10**10): for k in range(1, 5): s = str(pow(2, i, 10**(10**k))) if '1' in s or '3' in s or '5' in s or '7' in s or '9' in s: break else: print(2**i) It's really easily to parallelize, I was able to run it up to 10**8 in about 15min, so you would be able to run it up to 10**10 in a few hours with parallelization.

It's not 10^10 ≈ 2^33 though, it's 2^(10^10) = 2^10000000000, or about 9 999 999 967 orders of magnitude more.

You only need to check the actual powers of two.

Checking about 10^10 of them is just about doable as vhcr correctly showed. (I mean it wasn't optimal, but 'leave this running for 400 hours' is far from impossible)

Re: Powers of 2 with all even digits

#58

No additional terms up to 2^(10^10). - Michael S. Branicky, Apr 16 2023 How did he do this?

There likely is a trick but the above is also technically feasible as-is.

You have to do this for 10^10 (ten billion) powers. Each operation needs to check ~4.3billion decimal digits at worst (half that on average). It's highly parallelizable since each power is an easy to compute binary digit and you can do a binary->decimal conversion without relying on previous results which is a log(n) operation, ie one operation per decimal digit.

All up 10^10 powers * ((10^4.3)/2) decimal digits to calculate and check for each of those powers. Around 200 trillion operations all up in human terms. It's still hard enough you'd want a lot of compute. Getting each operation down to a nanosecond still means you're waiting 2.3days for a result. But it's also fair to say it's feasible.

Re: Powers of 2 with all even digits

#59

No additional terms up to 2^(10^10). - Michael S. Branicky, Apr 16 2023 How did he do this?

This is plausible with brute-force, perhaps with some basic optimization.

You only need to test 10^10 values, and that is just less than 2^34 cases. Not hard to brute force at all, and trivial to parallelize too.

Post reply on HN