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-4 of 4 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

A258410 Nonnegative integers with an equal number of occurrences of all digits in bijective base-2 numeration.

Original entry on oeis.org

4, 5, 18, 20, 21, 24, 25, 27, 70, 74, 76, 77, 82, 84, 85, 88, 89, 91, 98, 100, 101, 104, 105, 107, 112, 113, 115, 119, 270, 278, 282, 284, 285, 294, 298, 300, 301, 306, 308, 309, 312, 313, 315, 326, 330, 332, 333, 338, 340, 341, 344, 345, 347, 354, 356, 357
Offset: 1

Views

Author

Alois P. Heinz, May 29 2015

Keywords

Examples

			4 = 12_bij2, 5 = 21_bij2, 18 = 1122_bij2, 20 = 1212_bij2.
		

Crossrefs

Programs

  • Maple
    p:= proc(n) local d, m, r; m:= n; r:= 0;
          while m>0 do d:= irem(m, 2, 'm');
            if d=0 then d:=2; m:= m-1 fi;
            r:= r+x^d
          od;
          simplify(r/(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);

A257867 Nonnegative integers n such that in balanced ternary representation the number of occurrences of each trit doubles when n is squared.

Original entry on oeis.org

314, 942, 2824, 2826, 2854, 3074, 3130, 3212, 8066, 8090, 8096, 8170, 8224, 8324, 8426, 8450, 8472, 8478, 8480, 8512, 8534, 8562, 8578, 8588, 8656, 9222, 9224, 9390, 9404, 9636, 9638, 24198, 24206, 24270, 24288, 24510, 24670, 24672, 24674, 24676, 24802, 24972
Offset: 1

Views

Author

Alois P. Heinz, May 11 2015

Keywords

Examples

			942 is in the sequence because 942 = 110L0L0_bal3 and 942^2 = 887364 = 1LL0001L1L0100_bal3, where L represents (-1).
		

Crossrefs

Programs

  • 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; r
        end:
    a:= proc(n) option remember; local k;
          for k from 1+`if`(n=1, 0, a(n-1))
          while p(k)*2<>p(k^2) do od; k
        end:
    seq(a(n), n=1..50);
  • 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, 25001) if a(n**2).count(-1)==2*a(n).count(-1) and a(n**2).count(1)==2*a(n).count(1) and a(n**2).count(0)==2*a(n).count(0)]) # Indranil Ghosh, Jun 07 2017

A257868 Negative integers n such that in balanced ternary representation the number of occurrences of each trit doubles when n is squared.

Original entry on oeis.org

-314, -898, -942, -2694, -2824, -2826, -2962, -3014, -3070, -3074, -8066, -8082, -8090, -8096, -8132, -8170, -8224, -8336, -8426, -8434, -8450, -8472, -8478, -8480, -8618, -8656, -8870, -8886, -8918, -9008, -9042, -9210, -9222, -9224, -24198, -24226, -24246
Offset: 1

Views

Author

Alois P. Heinz, May 11 2015

Keywords

Examples

			-898 is in the sequence because -898 = LL10L1L_bal3 and (-898)^2 = 806404 = 1LLLL00L1LLL11_bal3, where L represents (-1).
		

Crossrefs

Programs

  • Maple
    p:= proc(n) local d, m, r; m:=abs(n); r:=0;
          while m>0 do
            d:= irem(m, 3, 'm');
            if d=2 then m:=m+1 fi;
            r:=r+x^`if`(n>0, d, irem(3-d, 3))
          od; r
        end:
    a:= proc(n) option remember; local k;
          for k from -1+`if`(n=1, 0, a(n-1)) by -1
          while p(k)*2<>p(k^2) do od; k
        end:
    seq(a(n), n=1..50);
  • Python
    def a(n):
        s=[]
        l=[]
        x=0
        while n>0:
            x=n%3
            n//=3
            if x==2:
                x=-1
                n+=1
            s.append(x)
            l.append(-x)
        return [s, l]
    print([-n for n in range(1, 25001) if a(n**2)[0].count(-1)==2*a(n)[1].count(-1) and a(n**2)[0].count(1)==2*a(n)[1].count(1) and a(n**2)[0].count(0)==2*a(n)[1].count(0)]) # Indranil Ghosh, Jun 07 2017
Showing 1-4 of 4 results.