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

A037847 a(n)=Sum{d(i-1)-d(i): d(i)

Original entry on oeis.org

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

Views

Author

Keywords

Comments

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

Crossrefs

Cf. A297330.

Programs

  • Maple
    A037847 := proc(n)
        a := 0 ;
        dgs := convert(n,base,6);
        for i from 2 to nops(dgs) do
            if op(i,dgs)R. J. Mathar, Oct 19 2015
  • Mathematica
    g[n_, b_] := Differences[IntegerDigits[n, b]]; b = 6; z = 120;
    Table[-Total[Select[g[n, b], # < 0 &]], {n, 1, z}];  (*A037856*)
    Table[Total[Select[g[n, b], # > 0 &]], {n, 1, z}];   (*A037847*)

Extensions

Definition swapped with A037856. - R. J. Mathar, Oct 19 2015
Updated by Clark Kimberling, Jan 19 2018

A037874 (1/2)*Sum{|d(i)-e(i)|}, where Sum{d(i)*6^i} is base 6 representation of n and e(i) are digits d(i) in nonincreasing order, for i=0,1,...,m.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Starts to differ from A037856 at n=220 = 1010_6. - R. J. Mathar, Aug 05 2025

Programs

  • Maple
    A037874 := proc(n)
        local a,dgs,dgsE ;
        a := 0 ;
        dgs := convert(n,base,6);
        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 A037883. - R. J. Mathar, Oct 19 2015
Showing 1-3 of 3 results.