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.

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

This page as a plain text file.
%I A297330 #26 May 31 2022 11:02:05
%S A297330 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,
%T A297330 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,
%U A297330 3,7,6,5,4,3,2,1,0,1,2,8,7,6,5,4,3,2
%N A297330 Total variation of base-10 digits of n; see Comments.
%C A297330 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:
%C A297330 ***
%C A297330 Base b     {DV(n,b)}   {UV(n,b)}    {TV(n,b)}
%C A297330 2           A033264     A037800      A037834
%C A297330 3           A037853     A037844      A037835
%C A297330 4           A037854     A037845      A037836
%C A297330 5           A037855     A037846      A037837
%C A297330 6           A037856     A037847      A037838
%C A297330 7           A037857     A037848      A037839
%C A297330 8           A037858     A037849      A037840
%C A297330 9           A037859     A037850      A037841
%C A297330 10          A037860     A037851      A297330
%C A297330 11          A297231     A297232      A297233
%C A297330 12          A297234     A297235      A297236
%C A297330 13          A297237     A297238      A297239
%C A297330 14          A297240     A297241      A297242
%C A297330 15          A297243     A297244      A297245
%C A297330 16          A297246     A297247      A297247
%C A297330 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:
%C A297330 ***
%C A297330 Base b    Sequence u   Sequence e   Sequence d
%C A297330 2           A005843      A005408      (none)
%C A297330 3           A297249      A297250      A297251
%C A297330 4           A297252      A297253      A297254
%C A297330 5           A297255      A297256      A297257
%C A297330 6           A297258      A297259      A297260
%C A297330 7           A297261      A297262      A297263
%C A297330 8           A297264      A297265      A297266
%C A297330 9           A297267      A297268      A297269
%C A297330 10          A297270      A297271      A297272
%C A297330 11          A297273      A297274      A297275
%C A297330 12          A297276      A297277      A297278
%C A297330 13          A297279      A297280      A297281
%C A297330 14          A297282      A297283      A297284
%C A297330 15          A297285      A297286      A297287
%C A297330 16          A297288      A297289      A297290
%C A297330 Not a duplicate of A151950: e.g., a(100)=1 but A151950(100)=11. - _Robert Israel_, Feb 06 2018
%H A297330 Clark Kimberling, <a href="/A297330/b297330.txt">Table of n, a(n) for n = 1..10000</a>
%e A297330 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.
%p A297330 f:= proc(n) local L,i; L:= convert(n,base,10);
%p A297330 add(abs(L[i+1]-L[i]),i=1..nops(L)-1) end proc:
%p A297330 map(f, [$1..100]); # _Robert Israel_, Feb 04 2018
%p A297330 # alternative
%p A297330 A297330 := proc(n)
%p A297330     A037860(n)+A037851(n) ;
%p A297330 end proc: # _R. J. Mathar_, Sep 27 2021
%t A297330 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 *)
%o A297330 (Python)
%o A297330 def A297330(n):
%o A297330     s = str(n)
%o A297330     return sum(abs(int(s[i])-int(s[i+1])) for i in range(len(s)-1)) # _Chai Wah Wu_, May 31 2022
%Y A297330 Cf. A037851, A297330, A297271, A297272.
%K A297330 nonn,base,easy
%O A297330 1,13
%A A297330 _Clark Kimberling_, Jan 17 2018