cp's OEIS Frontend

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.

A176189 Natural numbers whose squares have only 0's and 1's in base 3.

This page as a plain text file.
%I A176189 #16 Jun 08 2023 02:04:25
%S A176189 1,2,3,6,9,11,16,18,19,27,29,33,48,54,55,57,81,83,87,99,143,144,162,
%T A176189 163,165,171,243,245,249,261,262,297,421,429,432,451,486,487,489,495,
%U A176189 513,729,731,735,747,783,786,889,891,1263,1287,1296,1331,1342,1353,1458
%N A176189 Natural numbers whose squares have only 0's and 1's in base 3.
%C A176189 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.
%C A176189 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.
%C A176189 So, a(n)^2 belongs to A005836. - _Michel Marcus_, Nov 12 2012
%H A176189 Alois P. Heinz, <a href="/A176189/b176189.txt">Table of n, a(n) for n = 1..1000</a>
%H A176189 K. Mahler, <a href="http://matwbn.icm.edu.pl/ksiazki/aa/aa53/aa5316.pdf">The representation of squares to the base 3</a>, Acta Arith. Vol. 53, Issue 1 (1989), p. 99-106.
%e A176189 For n=16 we have 16^2=256="100111" (in base 3). Also (16*3)^2="10011100", (16*3^2)^2="1001110000", etc.
%t A176189 Select[Range[1200], Max[IntegerDigits[ #^2, 3]] == 1 &]
%o A176189 (Python)
%o A176189 from gmpy2 import digits
%o A176189 def ok(n): return "2" not in digits(n*n, 3)
%o A176189 print([k for k in range(1, 1500) if ok(k)]) # _Michael S. Branicky_, Jun 07 2023
%Y A176189 Cf. A005836.
%K A176189 base,easy,nonn
%O A176189 1,2
%A A176189 _Maciej Ireneusz Wilczynski_, Apr 11 2010