login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Smallest positive integer k such that 2^k has no '0' in the last n digits of its ternary expansion.
2

%I #38 Mar 18 2023 08:49:14

%S 1,2,4,10,15,15,15,15,15,15,50,50,101,101,101,101,143,143,143,143,143,

%T 143,143,143,143,1916,1916,1916,1916,1916,1916,82286,1134022,1639828,

%U 3483159,3483159,3483159,3917963,3917963,3917963,4729774,4729774,9827775,9827775,43622201,43622201,43622201

%N Smallest positive integer k such that 2^k has no '0' in the last n digits of its ternary expansion.

%C The powers of two are required to have at least n ternary digits, i.e., 2^k >= 3^(n-1).

%C Sloane (1973) conjectured that every power 2^n with n > 15 has a '0' somewhere in its ternary expansion (see A102483 and A346497).

%H Robert I. Saye, <a href="https://arxiv.org/abs/2202.13256">On two conjectures concerning the ternary digits of powers of two</a>, arXiv:2202.13256 [math.NT], 2022.

%t smallest[n_] := Module[{k}, k = Max[1, Ceiling[(n - 1) Log[2, 3]]]; While[MemberQ[Take[IntegerDigits[2^k, 3], -n], 0], ++k]; k]; Table[smallest[n], {n, 1, 20}]

%o (PARI) a(n) = my(k=1); while(!vecmin(Vec(Vecrev(digits(2^k,3)), n)), k++); k; \\ _Michel Marcus_, Feb 26 2022

%o (Python)

%o from sympy.ntheory.digits import digits

%o def a(n, startk=1):

%o k = max(startk, len(bin(3**(n-1))[2:]))

%o pow2 = 2**k

%o while 0 in digits(pow2, 3)[-n:]:

%o k += 1

%o pow2 *= 2

%o return k

%o an = 0

%o for n in range(1, 32):

%o an = a(n, an)

%o print(an, end=", ") # _Michael S. Branicky_, Mar 10 2022

%o (Python)

%o from itertools import count

%o def A351927(n):

%o kmax, m = 3**n, (3**(n-1)).bit_length()

%o k2 = pow(2,m,kmax)

%o for k in count(m):

%o a = k2

%o if 3*a >= kmax:

%o while a > 0:

%o a, b = divmod(a,3)

%o if b == 0:

%o break

%o else:

%o return k

%o k2 = 2*k2 % kmax # _Chai Wah Wu_, Mar 19 2022

%Y Cf. A004642, A117970, A102483, A346497, A351928.

%K nonn,base

%O 1,2

%A _Robert Saye_, Feb 25 2022