OFFSET
1,2
COMMENTS
If A007953(n) is seen as giving the resulting sum when inserting "+" signs between the digits of n, then a(n) gives the resulting difference when inserting "-" signs between the digits of n.
a(n) = 0 if and only if n is in A193772.
Signed version of A040997.
First differs from A225693 at n = 101.
abs(a(n)) first differs from abs(A055017(n)) at n = 102.
EXAMPLE
a(13) = 1 - 3 = -2.
a(74) = 7 - 4 = 3.
a(211) = 2 - 1 - 1 = 0.
MATHEMATICA
Table[Fold[#1 - #2 &, IntegerDigits@ n], {n, 76}] (* Michael De Vlieger, Jun 30 2016 *)
Table[-Differences[(Total/@TakeDrop[IntegerDigits[n], 1])], {n, 100}]//Flatten (* Harvey P. Dale, Dec 27 2022 *)
PROG
(PARI) diffdigits(n) = my(d=digits(n), dd=d[1]); for(k=2, #d, dd=dd-d[k]); dd
a(n) = diffdigits(n)
CROSSREFS
KEYWORD
sign,easy,base
AUTHOR
Felix Fröhlich, Jun 29 2016
STATUS
approved