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.

Showing 1-3 of 3 results.

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

A174657 Balanced ternary numbers with more negative trits than positive trits.

Original entry on oeis.org

5, 14, 15, 17, 23, 41, 42, 43, 44, 45, 47, 50, 51, 53, 59, 68, 69, 71, 77, 95, 122, 123, 124, 125, 126, 127, 128, 129, 131, 132, 133, 134, 135, 137, 140, 141, 143, 149, 150, 151, 152, 153, 155, 158, 159, 161, 167, 176, 177, 179, 185, 203, 204, 205, 206, 207, 209
Offset: 1

Views

Author

Daniel Forgues, Mar 26 2010

Keywords

Comments

Numbers for which the sum of trits is negative.

Crossrefs

Programs

  • Mathematica
    (* First run the program for A065363 to define balTernDigits *) Select[Range[210], Count[balTernDigits[#], -1] > Count[balTernDigits[#], 1] &] (* Alonso del Arte, Feb 26 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

A330904 Numbers m such that the number of 1's in the binary expansion of m equals the sum of the balanced ternary trits of m.

Original entry on oeis.org

0, 1, 10, 12, 13, 34, 36, 37, 66, 67, 120, 121, 192, 193, 202, 264, 265, 272, 273, 282, 283, 354, 355, 360, 361, 514, 516, 517, 520, 526, 544, 576, 577, 688, 840, 841, 848, 849, 904, 928, 1026, 1027, 1028, 1029, 1032, 1033, 1038, 1039, 1062, 1063, 1074, 1075
Offset: 1

Views

Author

Thomas König, May 02 2020

Keywords

Comments

If a(n) mod 6 = 0, then a(n+1) = a(n)+1.
a(41) = 1026, a(42) = 1027, a(43) = 1028 and a(44) = 1029 is the first time that four consecutive numbers appear in a(n). Conjecture: There is no occurrence of five or more consecutive numbers in a(n). Tested by exhaustive search up to 3^30. - Thomas König, Jul 19 2020

Examples

			34_10 = 11T1_bt = 10010_2, the sum of the digits is 1+1-1+1 = 2 for balanced ternary and 1+1 = 2 for base 2, so 34 is a term.
		

Crossrefs

Aside from the first term, subsequence of A174659.

Programs

  • PARI
    bt(n)= if (n==0, return (0)); my(d=digits(n, 3), c=1); while(c, if(d[1]==2, d=concat(0, d)); c=0; for(i=2, #d, if(d[i]==2, d[i]=-1; d[i-1]+=1; c=1))); vecsum(d); \\ A065363
    isok(m) = bt(m) == hammingweight(m); \\ Michel Marcus, Jun 07 2020

Formula

Integers m such that A065363(m) = A000120(m).

Extensions

Offset corrected by Thomas König, Jul 09 2020
Showing 1-3 of 3 results.