[go: up one dir, main page]

login
A174658
Balanced ternary numbers with equal count of negative trits and positive trits.
12
0, 2, 6, 8, 16, 18, 20, 24, 26, 32, 46, 48, 52, 54, 56, 60, 62, 70, 72, 74, 78, 80, 86, 96, 98, 104, 130, 136, 138, 142, 144, 146, 154, 156, 160, 162, 164, 168, 170, 178, 180, 182, 186, 188, 194, 208, 210, 214, 216, 218, 222, 224, 232, 234, 236, 240, 242, 248, 258
OFFSET
1,2
COMMENTS
Numbers for which the sum of trits is zero.
LINKS
MATHEMATICA
(* First run the program for A065363 to define balTernDigits *) A174658 = Select[Range[0, 299], Plus@@balTernDigits[#] == 0 &] (* Alonso del Arte, Feb 24 2011 *)
PROG
(Python)
def a(n):
s=0
x=0
while n>0:
x=n%3
n //= 3
if x==2:
x=-1
n+=1
s+=x
return s
print([n for n in range(301) if a(n)==0]) # Indranil Ghosh, Jun 07 2017
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Daniel Forgues, Mar 26 2010
STATUS
approved