cp's OEIS Frontend

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.

A174658 Balanced ternary numbers with equal count of negative trits and positive trits.

Original entry on oeis.org

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

Views

Author

Daniel Forgues, Mar 26 2010

Keywords

Comments

Numbers for which the sum of trits is zero.

Crossrefs

Programs

  • Mathematica
    (* First run the program for A065363 to define balTernDigits *) A174658 = Select[Range[0, 299], Plus@@balTernDigits[#] == 0 &] (* Alonso del Arte, Feb 24 2011 *)
  • 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