cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A351927 #38 Mar 18 2023 08:49:14
%S A351927 1,2,4,10,15,15,15,15,15,15,50,50,101,101,101,101,143,143,143,143,143,
%T A351927 143,143,143,143,1916,1916,1916,1916,1916,1916,82286,1134022,1639828,
%U A351927 3483159,3483159,3483159,3917963,3917963,3917963,4729774,4729774,9827775,9827775,43622201,43622201,43622201
%N A351927 Smallest positive integer k such that 2^k has no '0' in the last n digits of its ternary expansion.
%C A351927 The powers of two are required to have at least n ternary digits, i.e., 2^k >= 3^(n-1).
%C A351927 Sloane (1973) conjectured that every power 2^n with n > 15 has a '0' somewhere in its ternary expansion (see A102483 and A346497).
%H A351927 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 A351927 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 A351927 (PARI) a(n) = my(k=1); while(!vecmin(Vec(Vecrev(digits(2^k,3)), n)), k++); k; \\ _Michel Marcus_, Feb 26 2022
%o A351927 (Python)
%o A351927 from sympy.ntheory.digits import digits
%o A351927 def a(n, startk=1):
%o A351927     k = max(startk, len(bin(3**(n-1))[2:]))
%o A351927     pow2 = 2**k
%o A351927     while 0 in digits(pow2, 3)[-n:]:
%o A351927         k += 1
%o A351927         pow2 *= 2
%o A351927     return k
%o A351927 an = 0
%o A351927 for n in range(1, 32):
%o A351927     an = a(n, an)
%o A351927     print(an, end=", ") # _Michael S. Branicky_, Mar 10 2022
%o A351927 (Python)
%o A351927 from itertools import count
%o A351927 def A351927(n):
%o A351927     kmax, m = 3**n, (3**(n-1)).bit_length()
%o A351927     k2 = pow(2,m,kmax)
%o A351927     for k in count(m):
%o A351927         a = k2
%o A351927         if 3*a >= kmax:
%o A351927             while a > 0:
%o A351927                 a, b = divmod(a,3)
%o A351927                 if b == 0:
%o A351927                     break
%o A351927             else:
%o A351927                 return k
%o A351927         k2 = 2*k2 % kmax # _Chai Wah Wu_, Mar 19 2022
%Y A351927 Cf. A004642, A117970, A102483, A346497, A351928.
%K A351927 nonn,base
%O A351927 1,2
%A A351927 _Robert Saye_, Feb 25 2022