login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A256851 First-order differences for the cumulative sum of the digits of the integers when alternately adding and subtracting each digit of a particular value. 2
1, 2, 3, 4, 5, 6, 7, 8, 9, -1, 0, -1, -4, -3, -6, -5, -8, -7, -10, 2, -1, 0, 5, 2, 7, 4, 9, 6, 11, -3, 2, -5, 0, -1, -8, -3, -10, -5, -12, 4, -3, 6, -1, 0, 9, 2, 11, 4, 13, -5, 4, -7, 2, -9, 0, -1, -12, -3, -14, 6, -5, 8, -3, 10, -1, 0, 13, 2, 15, -7, 6, -9, 4, -11, 2, -13, 0, -1, -16, 8, -7, 10, -5, 12, -3, 14, -1, 0, 17, -9, 8, -11, 6, -13, 4, -15 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

The sequence was suggested by Wolfdieter Lang and represents a(n) - a(n-1) for the sequence A256379, which alternately adds and subtracts each digit of a particular value in the integers.

LINKS

Anthony Sand, Table of n, a(n) for n = 1..1000

FORMULA

a(n) = Sum_{m=1..r(n)} ((-1)^(a(n,m) + 1)* digit(n,m), where a(n,m) = A256100(n,m) read as an array with row length r(n) (number of digits of n), and digit(n,m) is the m-th digit of n (see the formula for A256379). - Wolfdieter Lang, Apr 15 2015

EXAMPLE

a(0) = 0, therefore a(1) - a(0) = 1 - 0 = 1.

For n = 1..9, the function is encountering each digit for the first time, therefore a(9) = 45.

For n = 10, the function encounters the digit 1 for the second time and subtracts it. Therefore a(10) = 44 and a(10) - a(9) = -1.

PROG

(PARI) { nmx=1000; b=10; dig=vector(b); si=0; for(i=1, b, dig[i]=1); n=0; s=0; while(n<nmx, n++; d=digits(n, b); prev=s; for(i=1, #d, s+=d[i]*dig[d[i]+1]; dig[d[i]+1]*=-1; ); print1(s-prev); if(n<nmx, print1(", ")); ); }

CROSSREFS

Cf. A167232, A037123, A256379.

Sequence in context: A055017 A225693 A040997 * A247149 A222210 A177894

Adjacent sequences:  A256848 A256849 A256850 * A256852 A256853 A256854

KEYWORD

sign,base,easy

AUTHOR

Anthony Sand, Apr 11 2015

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 16 23:49 EDT 2019. Contains 325092 sequences. (Running on oeis4.)