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.
%I A256379 #32 Mar 01 2025 08:38:54 %S A256379 1,3,6,10,15,21,28,36,45,44,44,43,39,36,30,25,17,10,0,2,1,1,6,8,15,19, %T A256379 28,34,45,42,44,39,39,38,30,27,17,12,0,4,1,7,6,6,15,17,28,32,45,40,44, %U A256379 37,39,30,30,29,17,14,0,6,1,9,6,16,15,15,28,30,45,38,44,35,39,28,30,17,17,16,0,8,1,11,6,18,15,29,28,28,45,36,44,33,39,26,30 %N A256379 Cumulative sum for n in base 10 when alternately adding and subtracting each digit of a particular value. %C A256379 For n = 1..9, the function is encountering each digit for the first time, therefore each is added to the cumulative sum. At n = 9, the sum is 45. At n = 10, the sum is 44, because the digit 1 is encountered for the second time and is therefore subtracted. At n = 11, the sum is again 44, because 1 is added and then subtracted. At n = 12, the sum is 43, because 1 is added and 2, encountered for the second time, is subtracted. %C A256379 0 <= a(n) <= 45 for all n; a(n) = a(n mod 20) for odd n. - _Danny Rorabaugh_, Mar 31 2015 %H A256379 Anthony Sand, <a href="/A256379/b256379.txt">Table of n, a(n) for n = 1..1000</a> %F A256379 a(n) = Sum_{k=1..n} M(k), with M(k) := Sum_{m=1..r(k)} (-1)^(a(k,m) + 1)*digit(k,m), where a(k,m) = A256100(k,m) read as an array with row length r(k) (number of digits of k), and digit(k,m) is the m-th digit of k. - _Wolfdieter Lang_, Apr 08 2015 %t A256379 f[n_] := Block[{g, r = PadRight[Range@ 9, 10]}, g[x_] := Boole[OddQ /@ DigitCount[x]]; Total[r Boole[OddQ /@ Total[g /@ Range@ n]]]]; Array[f, 120] (* _Michael De Vlieger_, Mar 29 2015 *) %o A256379 (PARI) { nmx=1000; b=10; dig=vector(b); for(i=1,b,dig[i]=1); n=0; s=0; while(n<nmx, n++; d=digits(n,b); for(i=1,#d, s+=d[i]*dig[d[i]+1]; dig[d[i]+1]*=-1; ); print1(s); if(n<nmx, print1(", ")); ); } %Y A256379 Cf. A037123, A167232, A256100, A256851 (first differences). %K A256379 nonn,base %O A256379 1,2 %A A256379 _Anthony Sand_, Mar 27 2015