A114457 Smallest k > 0 such that abs(S(k)P(k)-k) equals n, where S(k) is the sum and P(k) is the product of decimal digits of k or 0 if no such k exists.
1, 13, 2, 219, 724, 1285, 3, 23, 7789816, 11, 10, 2891, 4, 127, 226, 15, 3248, 163, 52, 31, 5, 33, 262, 12857, 24, 325, 16, 243, 38428, 617, 6, 68177, 172, 0, 62, 2275, 272, 22577, 118, 17, 40, 43, 7, 1339, 136, 25, 154, 143, 128, 125599, 34, 5619, 352, 1483
Offset: 0
Links
- Chai Wah Wu, Table of n, a(n) for n = 0..126
- Eric Weisstein's World of Mathematics, Sum-Product Number
Programs
-
Mathematica
a[n_] := Block[{k = 1}, While[id = IntegerDigits@k; Abs[(Plus @@ id)(Times @@ id) - k] != n, k++ ]; k]; Table[ a[n], {n, 0, 54}] (* Robert G. Wilson v, Dec 14 2005 *)
-
PARI
f(k) = my(d=digits(k)); abs(sum(j=1, #d, d[j])*prod(j=1,#d, d[j]) - k); a(n) = {k = 1; while(f(k) != n, k++); k;} \\ Michel Marcus, Jan 02 2015
Extensions
Added a(33), edited definition and verified a(34)-a(68) by Chai Wah Wu, Nov 22 2015
Comments