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-10 of 11 results. Next

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

A151949 a(n) = image of n under the Kaprekar map n -> (n with digits sorted into descending order) - (n with digits sorted into ascending order).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 9, 18, 27, 36, 45, 54, 63, 72, 18, 9, 0, 9, 18, 27, 36, 45, 54, 63, 27, 18, 9, 0, 9, 18, 27, 36, 45, 54, 36, 27, 18, 9, 0, 9, 18, 27, 36, 45, 45, 36, 27, 18, 9, 0, 9, 18, 27, 36, 54, 45, 36, 27, 18, 9, 0, 9, 18, 27, 63, 54, 45, 36, 27, 18, 9, 0, 9, 18, 72, 63, 54, 45, 36, 27, 18, 9, 0, 9, 81, 72, 63, 54, 45, 36, 27, 18, 9, 0, 99, 99, 198, 297, 396, 495, 594, 693, 792, 891, 99, 0, 99, 198, 297, 396, 495, 594, 693, 792
Offset: 0

Views

Author

N. J. A. Sloane, Aug 18 2009

Keywords

Comments

Entries are multiples of 9 - see A151950.
a(n) = A004186(n) - A004185(n); a(A010785(n)) = 0. - Reinhard Zumkeller, corrected: Mar 23 2015, Jul 09 2013

Examples

			For n = 15, a(15) = 51 - 15 = 36. - _Indranil Ghosh_, Feb 01 2017
		

Crossrefs

In other bases: A164884 (base 2), A164993 (base 3), A165012 (base 4), A165032 (base 5), A165051 (base 6), A165071 (base 7), A165090 (base 8), A165110 (base 9). - Joseph Myers, Sep 05 2009
Cf. also A004185, A004186, A099009 (fixed points).

Programs

  • Haskell
    a151949 n = a004186 n - a004185 n
    -- Reinhard Zumkeller, corrected: Mar 23 2015, Jul 09 2013
    
  • Mathematica
    f[n_] := Module[{idn = IntegerDigits@n, idns}, idns = Sort@ idn; FromDigits@ Reverse@ idns - FromDigits@ idns]; Table[ f@n, {n, 0, 200}] (* Harvey P. Dale, Aug 18 2009 *)
    Flatten[Table[Differences[FromDigits /@ {y = Sort[x = IntegerDigits[n]], Reverse[y]}], {n, 0, 74}]] (* Jayanta Basu, Jul 11 2013 *)
  • PARI
    a(n) = {my(d=digits(n)); fromdigits(vecsort(d,,4)) - fromdigits(vecsort(d));} \\ Michel Marcus, Dec 08 2019
  • Python
    def A151949(n):
        return int("".join(sorted(str(n),reverse=True)))-int("".join(sorted(str(n)))) # Indranil Ghosh, Feb 01 2017
    

Extensions

More terms from Robert G. Wilson v, Aug 19 2009
More than the usual number of terms are shown in order to distinguish this from similar sequences. - N. J. A. Sloane, Sep 22 2021

A165033 A165032(n)/4.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 1, 2, 3, 2, 1, 0, 1, 2, 3, 2, 1, 0, 1, 4, 3, 2, 1, 0, 6, 6, 12, 18, 24, 6, 0, 6, 12, 18, 12, 6, 6, 12, 18, 18, 12, 12, 12, 18, 24, 18, 18, 18, 18, 12, 12, 12, 18, 24, 12, 6, 6, 12, 18, 12, 6, 0, 6, 12, 18, 12, 6, 6, 12, 24, 18, 12, 12, 12, 18, 18, 18, 18, 24, 18, 12, 12
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Crossrefs

Cf. A165032.
In other bases: A164884 (base 2), A164994 (base 3), A165013 (base 4), A165052 (base 6), A165072 (base 7), A165091 (base 8), A165111 (base 9), A151950 (base 10).

A164994 A164993(n)/2.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 2, 1, 0, 4, 4, 8, 4, 0, 4, 8, 4, 4, 8, 8, 8, 8, 4, 4, 8, 4, 0, 13, 16, 29, 16, 13, 26, 29, 26, 29, 16, 13, 26, 13, 0, 13, 26, 13, 16, 29, 26, 29, 26, 13, 16, 29, 16, 13, 26, 29, 32, 29, 26, 29, 32, 29, 26, 29, 26, 29, 26, 13, 16, 29, 16, 13, 32, 29, 26, 29, 16, 13, 26
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Crossrefs

Cf. A164993.
In other bases: A164884 (base 2), A165013 (base 4), A165033 (base 5), A165052 (base 6), A165072 (base 7), A165091 (base 8), A165111 (base 9), A151950 (base 10).

A165013 a(n) = A165012(n)/3.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 1, 2, 2, 1, 0, 1, 3, 2, 1, 0, 5, 5, 10, 15, 5, 0, 5, 10, 10, 5, 5, 10, 15, 10, 10, 10, 10, 10, 10, 15, 10, 5, 5, 10, 10, 5, 0, 5, 15, 10, 5, 5, 15, 15, 15, 15, 15, 10, 10, 10, 15, 10, 5, 5, 15, 10, 5, 0, 21, 25, 46, 67, 25, 21, 42, 63, 46, 42, 46, 67, 67, 63, 67, 71, 25, 21
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Crossrefs

Cf. A165012.
In other bases: A164884 (base 2), A164994 (base 3), A165033 (base 5), A165052 (base 6), A165072 (base 7), A165091 (base 8), A165111 (base 9), A151950 (base 10).

A165052 A165051(n)/5.

Original entry on oeis.org

0, 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, 7, 7, 14, 21, 28, 35, 7, 0, 7, 14, 21, 28, 14, 7, 7, 14, 21, 28, 21, 14, 14, 14, 21, 28, 28, 21, 21, 21, 21, 28, 35, 28, 28, 28, 28, 28, 14, 14, 14, 21, 28, 35, 14, 7, 7, 14, 21, 28, 14
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Crossrefs

Cf. A165051.
In other bases: A164884 (base 2), A164994 (base 3), A165013 (base 4), A165033 (base 5), A165072 (base 7), A165091 (base 8), A165111 (base 9), A151950 (base 10).

A165072 A165071(n)/6.

Original entry on oeis.org

0, 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, 8, 8, 16, 24, 32, 40, 48, 8, 0, 8, 16, 24, 32, 40, 16, 8, 8, 16, 24, 32, 40, 24, 16, 16, 16, 24, 32, 40, 32, 24, 24, 24, 24, 32, 40, 40, 32, 32, 32, 32
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Crossrefs

Cf. A165071.
In other bases: A164884 (base 2), A164994 (base 3), A165013 (base 4), A165033 (base 5), A165052 (base 6), A165091 (base 8), A165111 (base 9), A151950 (base 10).

A165091 A165090(n)/7.

Original entry on oeis.org

0, 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, 9, 9, 18, 27, 36, 45, 54, 63, 9, 0, 9, 18, 27, 36, 45, 54, 18, 9, 9, 18, 27, 36, 45, 54, 27, 18, 18, 18, 27, 36
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Crossrefs

Cf. A165090.
In other bases: A164884 (base 2), A164994 (base 3), A165013 (base 4), A165033 (base 5), A165052 (base 6), A165072 (base 7), A165111 (base 9), A151950 (base 10).

A165111 A165110(n)/8.

Original entry on oeis.org

0, 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, 10, 10, 20, 30, 40, 50, 60, 70, 80, 10, 0, 10, 20, 30, 40, 50
Offset: 0

Views

Author

Joseph Myers, Sep 04 2009

Keywords

Crossrefs

Cf. A165110.
In other bases: A164884 (base 2), A164994 (base 3), A165013 (base 4), A165033 (base 5), A165052 (base 6), A165072 (base 7), A165091 (base 8), A151950 (base 10).

A151951 a(1) = 1113; thereafter a(n) = (a(n-1) with digits sorted into descending order) - (a(n-1) with digits sorted into ascending order) (see the Kaprekar map, A151949).

Original entry on oeis.org

1113, 1998, 8082, 8532, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174, 6174
Offset: 1

Views

Author

N. J. A. Sloane, Aug 18 2009

Keywords

Crossrefs

Programs

  • Mathematica
    NestList[FromDigits[Reverse[Sort[IntegerDigits[#]]]]-FromDigits[Sort[ IntegerDigits[ #]]]&,1113,40] (* or *) PadRight[{1113,1998,8082,8532},40,{6174}] (* Harvey P. Dale, May 10 2021 *)
Showing 1-10 of 11 results. Next