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
6, 8, 136, 138, 144, 154, 156, 160, 164, 168, 170, 180, 186, 188, 208, 210, 214, 218, 222, 224, 232, 236, 248, 258, 260, 266, 288, 294, 296, 312, 314, 320, 3406, 3412, 3414, 3430, 3432, 3438, 3484, 3486, 3492, 3510, 3568, 3574, 3576, 3592, 3594, 3600, 3622 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

Alois P. Heinz, Table of n, a(n) for n = 1..10000

Wikipedia, Balanced ternary

EXAMPLE

6 = 1L0_bal3, 8 = 10L_bal3, 136 = 1LL001_bal3, 138 = 1LL010_bal3, 144 = 1LL100_bal3, where L represents (-1).

MAPLE

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

while m>0 do

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

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

r:= r+x^d

od;

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

end:

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

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

while not p(k) do od; k

end:

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

PROG

(Python)

def a(n):

s=[]

x=0

while n>0:

x=n%3

n//=3

if x==2:

x=-1

n+=1

s.append(x)

return s

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

CROSSREFS

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

Subsequence of A174658.

Sequence in context: A324987 A013239 A013235 * A201387 A013236 A013242

Adjacent sequences: A257866 A257867 A257868 * A257870 A257871 A257872

KEYWORD

nonn,base

AUTHOR

Alois P. Heinz, May 11 2015

STATUS

approved

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 March 26 11:57 EDT 2023. Contains 361549 sequences. (Running on oeis4.)