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 A257867 #22 May 07 2021 09:10:22 %S A257867 314,942,2824,2826,2854,3074,3130,3212,8066,8090,8096,8170,8224,8324, %T A257867 8426,8450,8472,8478,8480,8512,8534,8562,8578,8588,8656,9222,9224, %U A257867 9390,9404,9636,9638,24198,24206,24270,24288,24510,24670,24672,24674,24676,24802,24972 %N A257867 Nonnegative integers n such that in balanced ternary representation the number of occurrences of each trit doubles when n is squared. %H A257867 Alois P. Heinz, <a href="/A257867/b257867.txt">Table of n, a(n) for n = 1..10000</a> %H A257867 Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_ternary">Balanced ternary</a> %e A257867 942 is in the sequence because 942 = 110L0L0_bal3 and 942^2 = 887364 = 1LL0001L1L0100_bal3, where L represents (-1). %p A257867 p:= proc(n) local d, m, r; m:=n; r:=0; %p A257867 while m>0 do %p A257867 d:= irem(m,3,'m'); %p A257867 if d=2 then m:=m+1 fi; %p A257867 r:=r+x^d %p A257867 od; r %p A257867 end: %p A257867 a:= proc(n) option remember; local k; %p A257867 for k from 1+`if`(n=1, 0, a(n-1)) %p A257867 while p(k)*2<>p(k^2) do od; k %p A257867 end: %p A257867 seq(a(n), n=1..50); %o A257867 (Python) %o A257867 def a(n): %o A257867 s=[] %o A257867 x=0 %o A257867 while n>0: %o A257867 x=n%3 %o A257867 n//=3 %o A257867 if x==2: %o A257867 x=-1 %o A257867 n+=1 %o A257867 s.append(x) %o A257867 return s %o A257867 print([n for n in range(1, 25001) if a(n**2).count(-1)==2*a(n).count(-1) and a(n**2).count(1)==2*a(n).count(1) and a(n**2).count(0)==2*a(n).count(0)]) # _Indranil Ghosh_, Jun 07 2017 %Y A257867 Cf. A117967, A140267, A061656, A061657, A061658, A061659, A061660, A061661, A061662, A061663, A114258, A257868, A257869, A258411. %K A257867 nonn,base %O A257867 1,1 %A A257867 _Alois P. Heinz_, May 11 2015