login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A257867 Nonnegative integers n such that in balanced ternary representation the number of occurrences of each trit doubles when n is squared. 4

%I #22 May 07 2021 09:10:22

%S 314,942,2824,2826,2854,3074,3130,3212,8066,8090,8096,8170,8224,8324,

%T 8426,8450,8472,8478,8480,8512,8534,8562,8578,8588,8656,9222,9224,

%U 9390,9404,9636,9638,24198,24206,24270,24288,24510,24670,24672,24674,24676,24802,24972

%N Nonnegative integers n such that in balanced ternary representation the number of occurrences of each trit doubles when n is squared.

%H Alois P. Heinz, <a href="/A257867/b257867.txt">Table of n, a(n) for n = 1..10000</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Balanced_ternary">Balanced ternary</a>

%e 942 is in the sequence because 942 = 110L0L0_bal3 and 942^2 = 887364 = 1LL0001L1L0100_bal3, where L represents (-1).

%p p:= proc(n) local d, m, r; m:=n; r:=0;

%p while m>0 do

%p d:= irem(m,3,'m');

%p if d=2 then m:=m+1 fi;

%p r:=r+x^d

%p od; r

%p end:

%p a:= proc(n) option remember; local k;

%p for k from 1+`if`(n=1, 0, a(n-1))

%p while p(k)*2<>p(k^2) do od; k

%p end:

%p seq(a(n), n=1..50);

%o (Python)

%o def a(n):

%o s=[]

%o x=0

%o while n>0:

%o x=n%3

%o n//=3

%o if x==2:

%o x=-1

%o n+=1

%o s.append(x)

%o return s

%o 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 Cf. A117967, A140267, A061656, A061657, A061658, A061659, A061660, A061661, A061662, A061663, A114258, A257868, A257869, A258411.

%K nonn,base

%O 1,1

%A _Alois P. Heinz_, May 11 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 29 22:36 EDT 2024. Contains 374734 sequences. (Running on oeis4.)