OFFSET
1,2
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000
EXAMPLE
496 is a term: s(496) = 4+9+6 = 19, p(s(496)) = 1*9 = 9, p(496) = 4*9*6 = 216, s(p(496)) = 2+1+6 = 9.
845 is a term: s(845) = 8+4+5 = 17, p(s(845)) = 1*7 = 7, p(845) = 8*4*5 = 160, s(p(845)) = 1+6+0 = 7.
From Jon E. Schoenfield, Jun 15 2024: (Start)
Expressed more visually:
.
Sum Sum
496 --------> 19 845 --------> 17
| 4+9+6 | | 8+4+5 |
P | 4 P | P | 8 P |
r | * r | 1 r | * r | 1
o | 9 o | * o | 4 o | *
d | * d | 9 d | * d | 7
| 6 | | 5 |
v Sum v v Sum v
216 --------> 9 160 --------> 7
2+1+6 1+6+0
(End)
MAPLE
P:=proc(q) local a, b, c; a:=convert(q, base, 10): b:=convert(a, `+`): c:=convert(a, `*`):
if convert(convert(b, base, 10), `*`)=convert(convert(c, base, 10), `+`) then q; fi; end: seq(P(i), i=1..10^3); # Paolo P. Lava, Jun 15 2024
MATHEMATICA
p[n_] := Times @@ IntegerDigits[n]; Select[Range[1000], p[DigitSum[#]] == DigitSum[p[#]] &] (* Paolo Xausa, Jun 17 2024 *)
PROG
(Python)
from math import prod
def ok(n):
d = list(map(int, str(n)))
p, s = prod(d), sum(d)
return sum(map(int, str(p))) == prod(map(int, str(s)))
print([k for k in range(1, 803) if ok(k)]) # Michael S. Branicky, Jun 15 2024
CROSSREFS
KEYWORD
easy,nonn,base
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, May 04 2007
STATUS
approved