OFFSET
1,2
COMMENTS
LINKS
Robert I. Saye, On two conjectures concerning the ternary digits of powers of two, arXiv:2202.13256 [math.NT], 2022.
MATHEMATICA
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}]
PROG
(PARI) a(n) = my(k=1); while(!vecmin(Vec(Vecrev(digits(2^k, 3)), n)), k++); k; \\ Michel Marcus, Feb 26 2022
(Python)
from sympy.ntheory.digits import digits
def a(n, startk=1):
k = max(startk, len(bin(3**(n-1))[2:]))
pow2 = 2**k
while 0 in digits(pow2, 3)[-n:]:
k += 1
pow2 *= 2
return k
an = 0
for n in range(1, 32):
an = a(n, an)
print(an, end=", ") # Michael S. Branicky, Mar 10 2022
(Python)
from itertools import count
def A351927(n):
kmax, m = 3**n, (3**(n-1)).bit_length()
k2 = pow(2, m, kmax)
for k in count(m):
a = k2
if 3*a >= kmax:
while a > 0:
a, b = divmod(a, 3)
if b == 0:
break
else:
return k
k2 = 2*k2 % kmax # Chai Wah Wu, Mar 19 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Saye, Feb 25 2022
STATUS
approved