login
Numbers k such that 2^k does not contain the digit 2 (probably finite).
9

%I #46 Feb 11 2023 07:45:22

%S 0,2,3,4,6,12,14,16,20,22,23,26,34,35,36,39,42,46,54,64,74,83,168

%N Numbers k such that 2^k does not contain the digit 2 (probably finite).

%C Is 168 the last term?

%C First row of A136291. - _R. J. Mathar_ Apr 29 2008

%C Equivalently, indices of zeros in A065710. - _M. F. Hasler_, Feb 10 2023

%F The last term is A094776(2), by definition. - _M. F. Hasler_, Feb 10 2023

%e Here is 2^168, conjecturally the largest power of 2 that does not contain a 2:

%e 374144419156711147060143317175368453031918731001856. - _N. J. A. Sloane_, Feb 10 2023

%p isA034293 := proc(n) RETURN(not 2 in convert(2^n,base,10)) ; end: for n from 0 to 100000 do if isA034293(n) then print(n) ; fi ; od: # _R. J. Mathar_, Oct 04 2007

%t Join[{0}, Select[ Range@10000, FreeQ[ IntegerDigits[2^# ], 2] &]] (* _Shyam Sunder Gupta_, Sep 01 2007 *)(* adapted by _Vincenzo Librandi_, May 07 2015 *)

%t Select[Range[0, 10^4], DigitCount[2^#][[2]] == 0 &] (* _Michael De Vlieger_, Apr 29 2016 *)

%o (Magma) [n: n in [0..1000] | not 2 in Intseq(2^n) ]; // _Vincenzo Librandi_, May 07 2015

%o (PARI) is(n)=setsearch(Set(digits(2^n)),2)==0 \\ _Charles R Greathouse IV_, May 10 2016

%o (PARI) is_A034293(n)=!foreach(digits(2^n),d,d==2&&return) \\ _M. F. Hasler_, Feb 10 2023

%o (Python)

%o def is_A034293(n): return'2'not in str(2**n)

%o [n for n in range(199) if is_A034293(n)] # _M. F. Hasler_, Feb 10 2023

%Y Cf. A007377.

%Y See also similar sequences listed in A035064.

%Y Cf. A065710, A094776.

%K base,nonn

%O 1,2

%A _Erich Friedman_

%E Edited by _N. J. A. Sloane_, Oct 03 2007

%E Removed keyword "fini" since it is only a conjecture that this sequence contains only finitely many terms. - _Altug Alkan_, May 07 2016