A176189 Natural numbers whose squares have only 0's and 1's in base 3.
1, 2, 3, 6, 9, 11, 16, 18, 19, 27, 29, 33, 48, 54, 55, 57, 81, 83, 87, 99, 143, 144, 162, 163, 165, 171, 243, 245, 249, 261, 262, 297, 421, 429, 432, 451, 486, 487, 489, 495, 513, 729, 731, 735, 747, 783, 786, 889, 891, 1263, 1287, 1296, 1331, 1342, 1353, 1458
Offset: 1
Examples
For n=16 we have 16^2=256="100111" (in base 3). Also (16*3)^2="10011100", (16*3^2)^2="1001110000", etc.
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.
Crossrefs
Cf. A005836.
Programs
-
Mathematica
Select[Range[1200], Max[IntegerDigits[ #^2, 3]] == 1 &]
-
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
Comments