%I #36 Jan 04 2024 15:34:53
%S 1,13,2,219,724,1285,3,23,7789816,11,10,2891,4,127,226,15,3248,163,52,
%T 31,5,33,262,12857,24,325,16,243,38428,617,6,68177,172,0,62,2275,272,
%U 22577,118,17,40,43,7,1339,136,25,154,143,128,125599,34,5619,352,1483
%N 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.
%C a(33) > 2*10^9; then sequence continues 62, 2275, 272, 22577, 118, 17, 40, 43, 7, 1339, 136, 25, 154, 143, 128, 125599, 34, 5619, 352, 1483, 18, 145, 8, 15457, 173, 14963, 60, 1727, 517, 1197, 1787456, 235, 642, 53, 116, ... - _Robert G. Wilson v_, Dec 14 2005
%C a(33) > 2*10^16. - _Floris M. Velleman_, Dec 17 2014
%C a(33) = 0. Modification of David W. Wilson's proof for A038369 shows that if a(33) > 0, then a(33) has at most 84 digits. This allows an exhaustive search of numbers of the form 2^a*3^b*5^c*7^d which shows that no such number exists. Other values of n for which a(n) is currently unknown and may be equal to 0 (based on analysis of numbers with at most 20 digits) are: 69, 111, 127, 146, 168, 172, 233, 243, 249, 273, 279, 281, 316, 327, 372, 533, 557, 579, 587, 621, 623, 647, 649, 676, 683, 713, 721, 816, 819, 821, 827, 861, 872, 917, 926, 927, 928, 939, 983, 996, 999, ... - _Chai Wah Wu_, Nov 22 2015
%C a(69) = a(111) = 0. To compute a(111), numbers of at most 85 digits were checked. - _Chai Wah Wu_, Dec 04 2015
%H Chai Wah Wu, <a href="/A114457/b114457.txt">Table of n, a(n) for n = 0..126</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Sum-ProductNumber.html">Sum-Product Number</a>
%t f[n_] := Block[{k = 1}, While[id = IntegerDigits@k; Abs[(Plus @@ id)(Times @@ id) - k] != n, k++ ]; k]; Table[ f[n], {n, 0, 54}] (* _Robert G. Wilson v_, Dec 14 2005 *)
%o (C++) unsigned long long f(int n = 33) { for (unsigned long long i = 0;; i++) { unsigned long long copy = i, prod = 1, sum = 0; while (i) { sum += i%10; prod *= i%10; i/=10; } if (abs(sum * prod - i == n) { return i; } } } // _Floris M. Velleman_, Dec 17 2014
%o (PARI) f(k) = my(d=digits(k)); abs(sum(j=1, #d, d[j])*prod(j=1,#d, d[j]) - k);
%o a(n) = {k = 1; while(f(k) != n, k++); k;} \\ _Michel Marcus_, Jan 02 2015
%Y Cf. A007953 (sum of digits), A007954 (product of digits), A038369.
%K nonn,base
%O 0,2
%A _Eric W. Weisstein_, Nov 28 2005
%E Added a(33), edited definition and verified a(34)-a(68) by _Chai Wah Wu_, Nov 22 2015