A256379 Cumulative sum for n in base 10 when alternately adding and subtracting each digit of a particular value.
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, 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, 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
Offset: 1
Links
- Anthony Sand, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
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 *)
-
PARI
{ nmx=1000; b=10; dig=vector(b); for(i=1,b,dig[i]=1); n=0; s=0; while(n
Formula
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
Comments