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!)
A257869 Nonnegative integers with an equal number of occurrences of all trits in balanced ternary representation. 5

%I #19 May 06 2021 11:04:31

%S 6,8,136,138,144,154,156,160,164,168,170,180,186,188,208,210,214,218,

%T 222,224,232,236,248,258,260,266,288,294,296,312,314,320,3406,3412,

%U 3414,3430,3432,3438,3484,3486,3492,3510,3568,3574,3576,3592,3594,3600,3622

%N Nonnegative integers with an equal number of occurrences of all trits in balanced ternary representation.

%H Alois P. Heinz, <a href="/A257869/b257869.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 6 = 1L0_bal3, 8 = 10L_bal3, 136 = 1LL001_bal3, 138 = 1LL010_bal3, 144 = 1LL100_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;

%p simplify(r/(1+x+x^2))::integer

%p end:

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

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

%p while not p(k) do od; k

%p end:

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

%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, 5001) if a(n).count(1)==a(n).count(-1) and a(n).count(-1)==a(n).count(0)]) # _Indranil Ghosh_, Jun 07 2017

%Y Cf. A117967, A140267, A257867, A257868, A258410.

%Y Subsequence of A174658.

%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 April 18 18:58 EDT 2024. Contains 371781 sequences. (Running on oeis4.)