A068994 Powers of 2 with all even digits.
2, 4, 8, 64, 2048
Offset: 1
Links
- Bogdan C. Dumitru, Finiteness of Powers of Two with All Even Digits, arXiv:2503.23177 [math.NT], 2025.
- Ted Dunning, Go program with sieve to accelerate scanning by ~1000x.
- Lukas Huwald, C program to check powers of 2 for even digits.
- Fredrik Johansson, Second C program.
- Index to divisibility sequences.
Programs
-
Mathematica
(*returns true if none of digits of n are odd, false o.w.*) f[n_] := Module[{ a, l, r, i}, a = IntegerDigits[n]; l = Length[a]; r = True; For[i = 1, i <= l, i++, If[Mod[a[[i]], 2] == 1, r = False; Break[ ]]]; r] (*main routine*) Do[p = 2^i; If[f[p], Print[p]], {i, 1, 10^4}] Select[2^Range[0,100],Union[Take[DigitCount[#],{1,-1,2}]]=={0}&] (* Harvey P. Dale, Dec 25 2012 *) Select[2^Range[0,100],AllTrue[IntegerDigits[#],EvenQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 18 2016 *)
-
PARI
f(n)=n=vecsort(eval(Vec(Str(n)))%2,,8);#v==1&&v[1]==0 m=Mod(1,10^19);for(n=1,1e5,m*=2;if(f(lift(m))&&f(2^n),print1(2^n", "))) \\ Charles R Greathouse IV, Apr 09 2012
Comments