login
A336797
Numbers, not divisible by 3, whose squares have exactly 4 nonzero digits in base 3.
0
7, 14, 16, 17, 26, 35, 47, 68, 350, 3788
OFFSET
1,1
COMMENTS
Is this sequence infinite?
Next term, if it exists, is > 3^500. - James Rayman, Feb 05 2021
LINKS
Alessio Moscariello, On sparse perfect powers, arXiv:2101.10415 [math.NT], 2021. See Question 11 p. 9.
EXAMPLE
7^2=49 in base 3 is 1211, so 7 is a term.
14^2=196 in base 3 is 21021, so 14 is a term.
MATHEMATICA
Select[Range[4000], Mod[#, 3] > 0 && Length @ Select[IntegerDigits[#^2, 3], #1 > 0 &] == 4 &] (* Amiram Eldar, Jan 27 2021 *)
PROG
(PARI) isok(n) = (n%3) && #select(x->x, digits(n^2, 3)) == 4;
(Python)
from gmpy2 import isqrt, is_square
import itertools
N = 1000
powers = [1]
a_list = []
while len(powers) < N: powers.append(3 * powers[-1])
def attempt(n):
if is_square(n): a_list.append(int(isqrt(n)))
for A, B, C in itertools.combinations(powers[1:], 3):
for a, b, c in itertools.product([1, 2], repeat=3):
attempt(a*A + b*B + c*C + 1)
print(sorted(a_list)) # James Rayman, Feb 05 2021
CROSSREFS
Cf. A007089 (numbers in base 3), A160385.
Sequence in context: A086779 A269173 A167197 * A100599 A353440 A198390
KEYWORD
nonn,base,more
AUTHOR
Michel Marcus, Jan 27 2021
STATUS
approved