OFFSET
1,2
COMMENTS
If 3 divides a(n) then a(n)/3 also appears in this sequence. Also the inverse is true: if a(n) appears, then (3^k)*a(n), for all k>=0, appears as well.
Note that a(n) usually does not consist only of 0's and 1's - it can be shown that in this case a(n)=3^k, for some k>=0.
So, a(n)^2 belongs to A005836. - Michel Marcus, Nov 12 2012
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
K. Mahler, The representation of squares to the base 3, Acta Arith. Vol. 53, Issue 1 (1989), p. 99-106.
EXAMPLE
For n=16 we have 16^2=256="100111" (in base 3). Also (16*3)^2="10011100", (16*3^2)^2="1001110000", etc.
MATHEMATICA
Select[Range[1200], Max[IntegerDigits[ #^2, 3]] == 1 &]
PROG
(Python)
from gmpy2 import digits
def ok(n): return "2" not in digits(n*n, 3)
print([k for k in range(1, 1500) if ok(k)]) # Michael S. Branicky, Jun 07 2023
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Maciej Ireneusz Wilczynski, Apr 11 2010
STATUS
approved