login
A062034
Positive numbers whose product of digits is twice the sum of the digits.
10
36, 44, 63, 138, 145, 154, 183, 224, 242, 318, 381, 415, 422, 451, 514, 541, 813, 831, 1146, 1164, 1225, 1233, 1252, 1323, 1332, 1416, 1461, 1522, 1614, 1641, 2125, 2133, 2152, 2215, 2222, 2251, 2313, 2331, 2512, 2521, 3123, 3132, 3213, 3231, 3312, 3321
OFFSET
1,1
LINKS
EXAMPLE
1225 belongs to the sequence as (1*2*2*5)/(1+2+2+5) =20/10 = 2.
MATHEMATICA
Select[Range[4000], Times@@IntegerDigits[#]==2Total[IntegerDigits[#]]&] (* Harvey P. Dale, Dec 11 2016 *)
PROG
(PARI) SumD(x)= { s=0; while (x>9, s=s+x-10*(x\10); x=x\10); return(s + x) }
ProdD(x)= { p=1; while (x>9, p=p*(x-10*(x\10)); x=x\10); return(p*x) }
{ n=-1; for (m=1, 2111281, if (ProdD(m)==2*SumD(m), write("b062034.txt", n++, " ", m)) ) } \\ Harry J. Smith, Jul 30 2009
(PARI) isok(n) = my(d=digits(n)); vecprod(d)==2*vecsum(d) \\ Mohammed Yaseen, Jul 28 2022
(Python)
from math import prod
def ok(n): d = list(map(int, str(n))); return prod(d) == 2*sum(d)
print([k for k in range(1, 4000) if ok(k)]) # Michael S. Branicky, Jul 28 2022
KEYWORD
nonn,base,easy
AUTHOR
Amarnath Murthy, Jun 27 2001
EXTENSIONS
Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jul 06 2001
Offset corrected by Mohammed Yaseen, Jul 28 2022
STATUS
approved