OFFSET
1,3
COMMENTS
Squares that are the sum of distinct powers of 3.
If k is a term, then so is 9*k.
The only square whose base-3 expansion has no 1 is 0.
LINKS
Robert Israel, Table of n, a(n) for n = 1..665
FORMULA
a(n) = A176189(n-1)^2 for n>=2. - Alois P. Heinz, Jun 07 2023
EXAMPLE
a(5) = 36 is a term because 36 = 6^2 = 3^2 + 3^3.
MAPLE
R:= {0, 1};
S:= {1};
for i from 1 to 20 do
S:= map(t -> (3*t, 3*t+1), S);
R:= R union select(issqr, S)
od:
R;
MATHEMATICA
Select[Range[0, 1000]^2, ! MemberQ[IntegerDigits[#, 3], 2] &] (* Amiram Eldar, Jun 01 2023 *)
PROG
(Python)
from gmpy2 import digits
def okA176189(n): return "2" not in digits(n*n, 3)
print([k**2 for k in range(1000) if okA176189(k)]) # Michael S. Branicky, Jun 07 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, May 31 2023
STATUS
approved