A274580 Digital difference of n: the most significant decimal digit of n minus the sum of the other digits.
1, 2, 3, 4, 5, 6, 7, 8, 9, 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, -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, -3, 7, 6, 5, 4, 3, 2, 1
Offset: 1
Examples
a(13) = 1 - 3 = -2. a(74) = 7 - 4 = 3. a(211) = 2 - 1 - 1 = 0.
Programs
-
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 *)
-
PARI
diffdigits(n) = my(d=digits(n), dd=d[1]); for(k=2, #d, dd=dd-d[k]); dd a(n) = diffdigits(n)
Comments