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

A174659 Numbers whose balanced ternary representation has more positive trits than negative trits.

Original entry on oeis.org

1, 3, 4, 7, 9, 10, 11, 12, 13, 19, 21, 22, 25, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 49, 55, 57, 58, 61, 63, 64, 65, 66, 67, 73, 75, 76, 79, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 93, 94, 97, 99, 100, 101, 102, 103, 105, 106, 107, 108, 109, 110, 111, 112
Offset: 1

Views

Author

Daniel Forgues, Mar 26 2010

Keywords

Comments

Numbers for which the sum of trits is positive.

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

Formula

a(n) < 2n. - Yifan Xie, Dec 24 2024

A334765 Numbers m such that the numbers of 1's in the binary expansion of m equals the negative sum of balanced ternary trits of m.

Original entry on oeis.org

0, 41, 68, 131, 132, 368, 384, 528, 1095, 1098, 1100, 1106, 1112, 1122, 1124, 1152, 1176, 1346, 1824, 2561, 3282, 3284, 3336, 3344, 3392, 3524, 4098, 4101, 4104, 4112, 4118, 4128, 4172, 4352, 4496, 4739, 4740, 5504, 6224, 9856, 9857, 9869, 9896, 9923, 9924
Offset: 1

Views

Author

Thomas König, May 10 2020

Keywords

Comments

a(116) = 32770, a(117) = 32771 and a(118) = 32772 is the first time that three consecutive numbers appear in this sequence. Conjecture: There is no occurrence of four or more consecutive numbers. Tested by exhaustive search up to a(n) = 3^26. - Thomas König, Jul 19 2020

Examples

			41_10 = 1TTTT_bt = 101001_2, the sum of the digits is 1-1-1-1-1 = -3 for balanced ternary and 1+1+1 = 3 for base 2, so 41 is a term.
		

Crossrefs

Aside from the first term, subsequence of A174657.

Programs

  • Mathematica
    Select[Range[0, 10^4], -Total@ If[First@ # == 0, Rest@ #, #] &[Prepend[IntegerDigits[#, 3], 0] //. {x___, y_, k_ /; k > 1, z___} :> {x, y + 1, -1, z}] == DigitCount[#, 2, 1] &] (* Michael De Vlieger, Jul 08 2020 *)
  • 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) == 0; \\ Michel Marcus, Jun 07 2020

Formula

Integers m such that -A065363(m) = A000120(m).
Showing 1-3 of 3 results.