login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A297815 Number of positive integers with n digits whose digit sum is equal to its digit product. 1
9, 1, 6, 12, 40, 30, 84, 224, 144, 45, 605, 495, 1170, 1092, 210, 240, 2448, 4896, 15846, 3420, 1750, 462, 15939, 0, 8100, 67925, 80730, 19656, 11774, 164430, 930, 29760, 197472, 0, 0, 1260, 23976, 50616, 54834, 395200, 1248860, 4253340, 75852, 0, 42570 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
EXAMPLE
The only term with two digits is 22: 2 * 2 = 2 + 2.
MATHEMATICA
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 *)
PROG
(Python)
import math
def digitProd(natNumber):
digitProd = 1
for letter in str(natNumber):
digitProd *= int(letter)
return digitProd
def digitSum(natNumber):
digitSum = 0
for letter in str(natNumber):
digitSum += int(letter)
return digitSum
for n in range(24):
count = 0
for a in range(int(math.pow(10, n)), int(math.pow(10, n+1))):
if digitProd(a) == digitSum(a):
count += 1
print(n+1, count)
(Python)
from sympy.utilities.iterables import combinations_with_replacement
from sympy import prod, factorial
def A297815(n):
f = factorial(n)
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
CROSSREFS
Sequence in context: A195712 A296473 A213916 * A021920 A367960 A280703
KEYWORD
nonn,base
AUTHOR
Reiner Moewald, Jan 06 2018
EXTENSIONS
a(10) and a(23) corrected by and a(25)-a(45) from Giovanni Resta, Feb 05 2018
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 8 23:08 EDT 2024. Contains 372341 sequences. (Running on oeis4.)