This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A297815 #26 Sep 25 2023 14:59:34 %S A297815 9,1,6,12,40,30,84,224,144,45,605,495,1170,1092,210,240,2448,4896, %T A297815 15846,3420,1750,462,15939,0,8100,67925,80730,19656,11774,164430,930, %U A297815 29760,197472,0,0,1260,23976,50616,54834,395200,1248860,4253340,75852,0,42570 %N A297815 Number of positive integers with n digits whose digit sum is equal to its digit product. %H A297815 Chai Wah Wu, <a href="/A297815/b297815.txt">Table of n, a(n) for n = 1..10000</a> %e A297815 The only term with two digits is 22: 2 * 2 = 2 + 2. %t A297815 cperm[w_] := Length[w]!/Times @@ ((Last /@ Tally[w])!); ric[s_, p_, w_, tg_] := Block[{d}, If[tg == 0, If[s == p, tot += cperm@ w], Do[ If[p*d > s + d + (tg-1)*9, Break[]]; ric[s+d, p*d, Append[w,d], tg-1], {d, Last@ w, 9}]]]; a[n_] := (tot=0; ric[#, #, {#}, n-1] & /@ Range[9]; tot); Array[a, 45] (* _Giovanni Resta_, Feb 05 2018 *) %o A297815 (Python) %o A297815 import math %o A297815 def digitProd(natNumber): %o A297815 digitProd = 1 %o A297815 for letter in str(natNumber): %o A297815 digitProd *= int(letter) %o A297815 return digitProd %o A297815 def digitSum(natNumber): %o A297815 digitSum = 0 %o A297815 for letter in str(natNumber): %o A297815 digitSum += int(letter) %o A297815 return digitSum %o A297815 for n in range(24): %o A297815 count = 0 %o A297815 for a in range(int(math.pow(10,n)), int(math.pow(10, n+1))): %o A297815 if digitProd(a) == digitSum(a): %o A297815 count += 1 %o A297815 print(n+1, count) %o A297815 (Python) %o A297815 from sympy.utilities.iterables import combinations_with_replacement %o A297815 from sympy import prod, factorial %o A297815 def A297815(n): %o A297815 f = factorial(n) %o A297815 return sum(f//prod(factorial(d.count(a)) for a in set(d)) for d in combinations_with_replacement(range(1,10),n) if prod(d) == sum(d)) # _Chai Wah Wu_, Feb 06 2018 %Y A297815 Cf. A034710, A061672. %K A297815 nonn,base %O A297815 1,1 %A A297815 _Reiner Moewald_, Jan 06 2018 %E A297815 a(10) and a(23) corrected by and a(25)-a(45) from _Giovanni Resta_, Feb 05 2018