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 A257868 #20 May 08 2021 11:23:36 %S A257868 -314,-898,-942,-2694,-2824,-2826,-2962,-3014,-3070,-3074,-8066,-8082, %T A257868 -8090,-8096,-8132,-8170,-8224,-8336,-8426,-8434,-8450,-8472,-8478, %U A257868 -8480,-8618,-8656,-8870,-8886,-8918,-9008,-9042,-9210,-9222,-9224,-24198,-24226,-24246 %N A257868 Negative integers n such that in balanced ternary representation the number of occurrences of each trit doubles when n is squared. %H A257868 Alois P. Heinz, <a href="/A257868/b257868.txt">Table of n, a(n) for n = 1..10000</a> %H A257868 Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_ternary">Balanced ternary</a> %e A257868 -898 is in the sequence because -898 = LL10L1L_bal3 and (-898)^2 = 806404 = 1LLLL00L1LLL11_bal3, where L represents (-1). %p A257868 p:= proc(n) local d, m, r; m:=abs(n); r:=0; %p A257868 while m>0 do %p A257868 d:= irem(m, 3, 'm'); %p A257868 if d=2 then m:=m+1 fi; %p A257868 r:=r+x^`if`(n>0, d, irem(3-d, 3)) %p A257868 od; r %p A257868 end: %p A257868 a:= proc(n) option remember; local k; %p A257868 for k from -1+`if`(n=1, 0, a(n-1)) by -1 %p A257868 while p(k)*2<>p(k^2) do od; k %p A257868 end: %p A257868 seq(a(n), n=1..50); %o A257868 (Python) %o A257868 def a(n): %o A257868 s=[] %o A257868 l=[] %o A257868 x=0 %o A257868 while n>0: %o A257868 x=n%3 %o A257868 n//=3 %o A257868 if x==2: %o A257868 x=-1 %o A257868 n+=1 %o A257868 s.append(x) %o A257868 l.append(-x) %o A257868 return [s, l] %o A257868 print([-n for n in range(1, 25001) if a(n**2)[0].count(-1)==2*a(n)[1].count(-1) and a(n**2)[0].count(1)==2*a(n)[1].count(1) and a(n**2)[0].count(0)==2*a(n)[1].count(0)]) # _Indranil Ghosh_, Jun 07 2017 %Y A257868 Cf. A117967, A140267, A061656, A061657, A061658, A061659, A061660, A061661, A061662, A061663, A114258, A257867, A257869. %K A257868 sign,base %O A257868 1,1 %A A257868 _Alois P. Heinz_, May 11 2015