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.
%I A336797 #36 Feb 14 2021 13:29:55 %S A336797 7,14,16,17,26,35,47,68,350,3788 %N A336797 Numbers, not divisible by 3, whose squares have exactly 4 nonzero digits in base 3. %C A336797 Is this sequence infinite? %C A336797 Next term, if it exists, is > 3^500. - _James Rayman_, Feb 05 2021 %H A336797 Alessio Moscariello, <a href="https://arxiv.org/abs/2101.10415">On sparse perfect powers</a>, arXiv:2101.10415 [math.NT], 2021. See Question 11 p. 9. %e A336797 7^2=49 in base 3 is 1211, so 7 is a term. %e A336797 14^2=196 in base 3 is 21021, so 14 is a term. %t A336797 Select[Range[4000], Mod[#, 3] > 0 && Length @ Select[IntegerDigits[#^2, 3], #1 > 0 &] == 4 &] (* _Amiram Eldar_, Jan 27 2021 *) %o A336797 (PARI) isok(n) = (n%3) && #select(x->x, digits(n^2, 3)) == 4; %o A336797 (Python) %o A336797 from gmpy2 import isqrt, is_square %o A336797 import itertools %o A336797 N = 1000 %o A336797 powers = [1] %o A336797 a_list = [] %o A336797 while len(powers) < N: powers.append(3 * powers[-1]) %o A336797 def attempt(n): %o A336797 if is_square(n): a_list.append(int(isqrt(n))) %o A336797 for A, B, C in itertools.combinations(powers[1:], 3): %o A336797 for a, b, c in itertools.product([1, 2], repeat=3): %o A336797 attempt(a*A + b*B + c*C + 1) %o A336797 print(sorted(a_list)) # _James Rayman_, Feb 05 2021 %Y A336797 Cf. A007089 (numbers in base 3), A160385. %K A336797 nonn,base,more %O A336797 1,1 %A A336797 _Michel Marcus_, Jan 27 2021