A062329 a(n) = (sum of digits of n) - (product of digits of n).
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7, 3, 1, -1, -3, -5, -7, -9, -11, -13, -15, 4, 1, -2, -5, -8, -11, -14, -17, -20, -23, 5, 1, -3, -7, -11, -15, -19, -23, -27, -31, 6, 1, -4, -9, -14, -19, -24, -29, -34, -39, 7, 1, -5, -11, -17, -23, -29, -35, -41, -47, 8, 1, -6, -13, -20, -27
Offset: 0
Examples
a(23) = 2 + 3 - 2*3 = -1. a(49) = -(4*9) + (4 + 9) = -36 + 13 = -23.
Links
- Harry J. Smith, Table of n, a(n) for n = 0..1000
Crossrefs
Programs
-
Mathematica
a[n_] := (t = IntegerDigits[n]; Plus @@ t - Times @@ t); Table[ a[n], {n, 0, 75}] (* Robert G. Wilson v *)
Extensions
Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jun 22 2001
Signed version from Henry Bottomley, Jun 29 2001