A128290 If p(x) is the product of the digits of the number x and s(x) the sum of the digits then the sequence lists all the numbers k for which p(s(k)) = s(p(k)), with k >= 1.
1, 2, 3, 4, 5, 6, 7, 8, 9, 22, 36, 63, 109, 123, 132, 158, 185, 190, 199, 208, 213, 231, 280, 289, 298, 307, 312, 321, 333, 370, 406, 458, 460, 469, 485, 496, 505, 518, 548, 550, 556, 559, 565, 581, 584, 595, 604, 640, 649, 655, 667, 676, 694, 703, 730, 766, 802
Offset: 1
Examples
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)
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000
Programs
-
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 *)
-
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
Comments