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.

A297330 Total variation of base-10 digits of n; see Comments.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 8, 7, 6, 5, 4, 3, 2
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). Guide to related sequences and partitions of the natural numbers:
***
Base b {DV(n,b)} {UV(n,b)} {TV(n,b)}
For each b, let u = {n : UV(n,b) < DV(n,b)}, e = {n : UV(n,b) = DV(n,b)}, and d = {n : UV(n,b) > DV(n,b)}. The sets u,e,d partition the natural numbers. A guide to the matching sequences for u, e, d follows:
***
Base b Sequence u Sequence e Sequence d
2 A005843 A005408 (none)
Not a duplicate of A151950: e.g., a(100)=1 but A151950(100)=11. - Robert Israel, Feb 06 2018

Examples

			13684632 has DV = 8-4 + 6-3 + 3-2 = 8 and has UV = 3-1 + 6-3 + 8-6 + 6-4 = 9, so that a(13684632) = DV + UV = 17.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local L,i; L:= convert(n,base,10);
    add(abs(L[i+1]-L[i]),i=1..nops(L)-1) end proc:
    map(f, [$1..100]); # Robert Israel, Feb 04 2018
    # alternative
    A297330 := proc(n)
        A037860(n)+A037851(n) ;
    end proc: # R. J. Mathar, Sep 27 2021
  • Mathematica
    b = 10; z = 120; t = Table[Total@Flatten@Map[Abs@Differences@# &, Partition[ IntegerDigits[n, b], 2, 1]], {n, z}] (* after Michael De Vlieger, e.g. A037834 *)
  • Python
    def A297330(n):
        s = str(n)
        return sum(abs(int(s[i])-int(s[i+1])) for i in range(len(s)-1)) # Chai Wah Wu, May 31 2022

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

Original entry on oeis.org

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

Views

Author

Keywords

Programs

  • Maple
    A037855 := proc(n)
        a := 0 ;
        dgs := convert(n,base,5);
        for i from 2 to nops(dgs) do
            if op(i,dgs)>op(i-1,dgs) then
                a := a+op(i,dgs)-op(i-1,dgs) ;
            end if;
        end do:
        a ;
    end proc: # R. J. Mathar, Oct 19 2015

Extensions

Definition swapped with A037846. - R. J. Mathar, Oct 19 2015

A037882 a(n)=(1/2)*Sum{|d(i)-e(i)|} where Sum{d(i)*5^i} is the base 5 representation of n and e(i) are the digits d(i) in nondecreasing order.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Starts to differ from A037846 at n=137 = 1022_5. -R. J. Mathar, Aug 05 2025

Programs

  • Maple
    A037882 := proc(n)
        local a,dgs,dgsE ;
        a := 0 ;
        dgs := convert(n,base,5);
        dgsE := sort(dgs) ;
        for i from 1 to nops(dgs) do
            a := a+ abs(op(i,dgs)-op(i,dgsE)) ;
        end do:
        a/2 ;
    end proc: # R. J. Mathar, Oct 19 2015

Extensions

Definition swapped with A037873. - R. J. Mathar, Oct 19 2015
Showing 1-3 of 3 results.