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.

Previous Showing 11-20 of 20 results.

A297248 Total variation of base-16 digits of n; see Comments.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 5, 4, 3
Offset: 1

Views

Author

Clark Kimberling, Jan 17 2018

Keywords

Comments

Suppose that a number n has base-b digits b(m), b(m-1), ..., b(0). The base-b down-variation of n is the sum DV(n,b) of all d(i)-d(i-1) for which d(i) > d(i-1); the base-b up-variation of n is the sum UV(n,b) of all d(k-1)-d(k) for which d(k) < d(k-1). The total base-b variation of n is the sum TV(n,b) = DV(n,b) + UV(n,b). See A297330 for a guide to related sequences and partitions of the natural numbers:

Examples

			3^10 in base 16:  14, 6, 10, 9; here, DV = 9 and UV = 4, so that a(2^20) = 13.
		

Crossrefs

Programs

  • Mathematica
    b = 16; z = 120; t = Table[Total@Flatten@Map[Abs@Differences@# &,      Partition[IntegerDigits[n, b], 2, 1]], {n, z}] (* cf. Michael De Vlieger, e.g. A037834 *)

A374176 a(n) is the maximum number of consecutive bit changes in the binary representation of n.

Original entry on oeis.org

0, 1, 0, 1, 2, 1, 0, 1, 1, 3, 2, 1, 2, 1, 0, 1, 1, 2, 1, 3, 4, 2, 2, 1, 1, 3, 2, 1, 2, 1, 0, 1, 1, 2, 1, 2, 3, 1, 1, 3, 3, 5, 4, 2, 2, 2, 2, 1, 1, 2, 1, 3, 4, 2, 2, 1, 1, 3, 2, 1, 2, 1, 0, 1, 1, 2, 1, 2, 3, 1, 1, 2, 2, 4, 3, 1, 2, 1, 1, 3, 3, 3, 3, 5, 6, 4, 4, 2, 2, 3, 2, 2, 2, 2, 2, 1, 1, 2, 1, 2, 3, 1, 1, 3, 3
Offset: 1

Views

Author

Hugo Pfoertner, Jul 05 2024

Keywords

Examples

			a(1117) = 3:
  1117_2 = [1 0 0 0 1 0 1 1 1 0 1]
             ^     ^ ^ ^     ^ ^
             1       3        2
            consecutive changes
		

Crossrefs

Cf. A000975 (index of first occurrence of n).

Programs

  • Maple
    b:= n-> `if`(n<2, [0$2], (f-> (t-> [t, max(t, f[2])])(
            `if`(n mod 4 in {0, 3}, 0, f[1]+1)))(b(iquo(n, 2)))):
    a:= n-> b(n)[2]:
    seq(a(n), n=1..105);  # Alois P. Heinz, Jul 07 2024
  • PARI
    a(n) = {my(b=digits(n,2), d=#b, m=0, j=b[1], c=0); for(k=2, d, if(b[k]!=j, c++; m=max(m,c), c=0); j=b[k]); m}
    
  • Python
    def a(n):
        b, c, m = bin(n)[2:], 0, 0
        for i in range(len(b)-1):
            if b[i] != b[i+1]: c += 1
            else: m = max(m, c); c = 0
        return max(m, c)
    print([a(n) for n in range(1, 89)]) # Michael S. Branicky, Jul 06 2024
    
  • Python
    # using formula
    from itertools import groupby
    def a(n): return max((len(list(g)) for k, g in groupby(bin(n^(n>>1))[3:]) if k=="1"), default=0)
    print([a(n) for n in range(1, 89)]) # Michael S. Branicky, Jul 06 2024

Formula

a(n) = A038374(A038554(n)), with A038374(0) = 0. - Michael S. Branicky, Jul 06 2024

A037835 Sum{|d(i)-d(i-1)|: i=0,1,...,m}, where Sum{d(i)*3^i: i=0,1,...,m} is base 3 representation of n.

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 1, 0, 1, 2, 3, 1, 0, 1, 3, 2, 1, 2, 3, 4, 2, 1, 2, 2, 1, 0, 1, 2, 3, 3, 2, 3, 5, 4, 3, 1, 2, 3, 1, 0, 1, 3, 2, 1, 3, 4, 5, 3, 2, 3, 3, 2, 1, 2, 3, 4, 4, 3, 4, 6, 5, 4, 2, 3, 4, 2, 1, 2, 4, 3, 2, 2, 3, 4, 2, 1, 2, 2, 1, 0, 1, 2, 3, 3, 2, 3, 5, 4, 3, 3
Offset: 1

Views

Author

Keywords

Comments

This is the base-3 total variation sequence; see A297330. - Clark Kimberling

Crossrefs

Cf. A297330.

Programs

  • Maple
    A037835 := proc(n)
        local dgs ;
        dgs := convert(n,base,3);
        add( abs(op(i,dgs)-op(i-1,dgs)),i=2..nops(dgs)) ;
    end proc: # R. J. Mathar, Oct 16 2015
  • Mathematica
    b = 3; z = 120; t = Table[Total@Flatten@Map[Abs@Differences@# &,      Partition[IntegerDigits[n, b], 2, 1]], {n, z}] (* cf. Michael De Vlieger, A037834 *)

Extensions

Updated by Clark Kimberling, Jan 19 2018

A037836 a(n) = Sum{|d(i)-d(i-1)|: i=1,...,m}, where Sum{d(i)*4^i: i=0,1,...,m} is the base 4 representation of n.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 2, 2, 1, 0, 1, 3, 2, 1, 0, 1, 2, 3, 4, 1, 0, 1, 2, 3, 2, 1, 2, 5, 4, 3, 2, 2, 3, 4, 5, 2, 1, 2, 3, 2, 1, 0, 1, 4, 3, 2, 1, 3, 4, 5, 6, 3, 2, 3, 4, 3, 2, 1, 2, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 3, 4, 5, 4, 3, 4, 7, 6, 5, 4, 1, 2, 3, 4, 1, 0, 1, 2, 3, 2, 1
Offset: 1

Views

Author

Keywords

Comments

This is the base-4 total variation sequence; see A297330. - Clark Kimberling, Jan 18 2017

Crossrefs

Cf. A297330.

Programs

  • Maple
    A037836 := proc(n)
        local dgs ;
        dgs := convert(n,base,4);
        add( abs(op(i,dgs)-op(i-1,dgs)),i=2..nops(dgs)) ;
    end proc: # R. J. Mathar, Oct 16 2015
  • Mathematica
    b = 4; z = 120; t = Table[Total@Flatten@Map[Abs@Differences@# &, Partition[IntegerDigits[n, b], 2, 1]], {n, z}] (* cf. Michael De Vlieger, A037834 *)

Extensions

Updated by Clark Kimberling, Jan 20 2018

A037837 a(n) = Sum{|d(i)-d(i-1)|: i=1,...,m}, where Sum{d(i)*5^i: i=0,1,...,m} is the base 5 representation of n.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 1, 0, 1, 2, 3, 3, 2, 1, 2, 3, 5, 4, 3, 2, 3, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 2, 1, 2, 3, 4, 2, 1, 0, 1, 2, 4, 3, 2, 1, 2, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 3, 2, 3, 4, 5, 3, 2, 1, 2, 3, 3
Offset: 1

Views

Author

Keywords

Comments

This is the base-5 total variation sequence; see A297330. - Clark Kimberling, Jan 18 2017

Crossrefs

Cf. A297330.

Programs

  • Maple
    A037837 := proc(n)
        local dgs ;
        dgs := convert(n,base,5);
        add( abs(op(i,dgs)-op(i-1,dgs)),i=2..nops(dgs)) ;
    end proc: # R. J. Mathar, Oct 16 2015
  • Mathematica
    b = 5; z = 120; t = Table[Total@Flatten@Map[Abs@Differences@# &, Partition[IntegerDigits[n, b], 2, 1]], {n, z}] (* cf. Michael De Vlieger, A037834 *)

Extensions

Updated by Clark Kimberling, Jan 20 2018

A037838 a(n) = Sum{|d(i)-d(i-1)|: i=1,...,m}, where Sum{d(i)*6^i: i=0,1,...,m} is the base 6 representation of n.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 2, 1, 0, 1, 2, 3, 3, 2, 1, 0, 1, 2, 4, 3, 2, 1, 0, 1, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 1, 0, 1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 3, 4, 7, 6, 5, 4, 3, 4, 9, 8, 7, 6, 5, 4, 2, 3, 4, 5, 6, 7, 2, 1, 2, 3, 4, 5, 2, 1, 0, 1, 2, 3, 4
Offset: 1

Views

Author

Keywords

Comments

This is the base-6 total variation sequence; see A297330. - Clark Kimberling, Jan 18 2017

Crossrefs

Cf. A297330.

Programs

  • Maple
    A037838 := proc(n)
        local dgs ;
        dgs := convert(n,base,6);
        add( abs(op(i,dgs)-op(i-1,dgs)),i=2..nops(dgs)) ;
    end proc:
    seq(A037838(n),n=1..100) ; # R. J. Mathar, Jul 31 2024
  • Mathematica
    b = 6; z = 120; t = Table[Total@Flatten@Map[Abs@Differences@# &, Partition[IntegerDigits[n, b], 2, 1]], {n, z}] (* cf. Michael De Vlieger, A037834 *)

Extensions

Updated by Clark Kimberling, Jan 20 2018

A037839 a(n) = Sum{|d(i)-d(i-1)|: i=1,...,m}, where Sum{d(i)*7^i: i=0,1,...,m} is the base 7 representation of n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 3, 4, 3, 2, 1, 0, 1, 2, 5, 4, 3, 2, 1, 0, 1, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 1, 0, 1, 2, 3, 4, 5, 3, 2, 1, 2, 3, 4, 5, 5, 4, 3, 2, 3, 4, 5, 7, 6, 5, 4, 3, 4, 5, 9, 8, 7, 6, 5, 4, 5
Offset: 1

Views

Author

Keywords

Comments

This is the base-7 total variation sequence; see A297330. - Clark Kimberling, Jan 18 2017

Crossrefs

Cf. A297330.

Programs

  • Mathematica
    b = 7; z = 120; t = Table[Total@Flatten@Map[Abs@Differences@# &, Partition[IntegerDigits[n, b], 2, 1]], {n, z}] (* cf. Michael De Vlieger, A037834 *)

Extensions

Updated by Clark Kimberling, Jan 20 2018

A037840 a(n)=Sum{|d(i)-d(i-1)|: i=1,...,m}, where Sum{d(i)*8^i: i=0,1,...,m} is the base 8 representation of n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 2, 1, 0, 1, 2, 3, 4, 5, 3, 2, 1, 0, 1, 2, 3, 4, 4, 3, 2, 1, 0, 1, 2, 3, 5, 4, 3, 2, 1, 0, 1, 2, 6, 5, 4, 3, 2, 1, 0, 1, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 1, 0, 1, 2, 3, 4, 5, 6, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3
Offset: 1

Views

Author

Keywords

Comments

This is the base-8 total variation sequence; see A297330. - Clark Kimberling, Jan 18 2017

Crossrefs

Cf. A297330.

Programs

  • Mathematica
    b = 8; z = 120; t = Table[Total@ Flatten@ Map[Abs@ Differences@ # &, Partition[IntegerDigits[n, b], 2, 1]], {n, z}] (* cf. Michael De Vlieger, A037834 *)

Extensions

Updated by Clark Kimberling, Jan 20 2018

A037841 a(n)=Sum{|d(i)-d(i-1)|: i=1,...,m}, where Sum{d(i)*9^i: i=0,1,...,m} is the base 9 representation of n.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 2, 1, 0, 1, 2, 3, 4, 5, 6, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 1, 2, 3, 6, 5, 4, 3, 2, 1, 0, 1, 2, 7, 6, 5, 4, 3, 2, 1, 0, 1, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1
Offset: 1

Views

Author

Keywords

Comments

This is the base-9 total variation sequence; see A297330. - Clark Kimberling, Jan 18 2017

Crossrefs

Cf. A297330.

Programs

  • Mathematica
    b = 9; z = 120; t = Table[Total@ Flatten@ Map[Abs@ Differences@ # &, Partition[IntegerDigits[n, b], 2, 1]], {n, z}] (* cf. Michael De Vlieger, A037834 *)

Extensions

Updated by Clark Kimberling, Jan 20 2018

A297236 Total variation of base-12 digits of n; see Comments.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 7, 6, 5
Offset: 1

Views

Author

Clark Kimberling, Jan 17 2018

Keywords

Comments

Suppose that a number n has base-b digits b(m), b(m-1), ..., b(0). The base-b down-variation of n is the sum DV(n,b) of all d(i)-d(i-1) for which d(i) > d(i-1); the base-b up-variation of n is the sum UV(n,b) of all d(k-1)-d(k) for which d(k) < d(k-1). The total base-b variation of n is the sum TV(n,b) = DV(n,b) + UV(n,b). See A297330 for a guide to related sequences and partitions of the natural numbers:

Examples

			2^20 in base 12:  4, 2, 6, 9, 9, 4; here, DV = 7 and UV = 7, so that a(2^20) = 14.
		

Crossrefs

Programs

  • Mathematica
    b = 12; z = 120; t = Table[Total@Flatten@Map[Abs@Differences@# &,      Partition[IntegerDigits[n, b], 2, 1]], {n, z}] (* cf. Michael De Vlieger, e.g. A037834 *)
Previous Showing 11-20 of 20 results.