%I #19 Jul 29 2022 09:54:41
%S 36,44,63,138,145,154,183,224,242,318,381,415,422,451,514,541,813,831,
%T 1146,1164,1225,1233,1252,1323,1332,1416,1461,1522,1614,1641,2125,
%U 2133,2152,2215,2222,2251,2313,2331,2512,2521,3123,3132,3213,3231,3312,3321
%N Positive numbers whose product of digits is twice the sum of the digits.
%H Harry J. Smith, <a href="/A062034/b062034.txt">Table of n, a(n) for n = 1..500</a>
%e 1225 belongs to the sequence as (1*2*2*5)/(1+2+2+5) =20/10 = 2.
%t Select[Range[4000],Times@@IntegerDigits[#]==2Total[IntegerDigits[#]]&] (* _Harvey P. Dale_, Dec 11 2016 *)
%o (PARI) SumD(x)= { s=0; while (x>9, s=s+x-10*(x\10); x=x\10); return(s + x) }
%o ProdD(x)= { p=1; while (x>9, p=p*(x-10*(x\10)); x=x\10); return(p*x) }
%o { n=-1; for (m=1, 2111281, if (ProdD(m)==2*SumD(m), write("b062034.txt", n++, " ", m)) ) } \\ _Harry J. Smith_, Jul 30 2009
%o (PARI) isok(n) = my(d=digits(n)); vecprod(d)==2*vecsum(d) \\ _Mohammed Yaseen_, Jul 28 2022
%o (Python)
%o from math import prod
%o def ok(n): d = list(map(int, str(n))); return prod(d) == 2*sum(d)
%o print([k for k in range(1, 4000) if ok(k)]) # _Michael S. Branicky_, Jul 28 2022
%Y Cf. A011540, A034710, A062035, A062036, A062382, A062037, A062384, A062040, A062041, A062043, A062045.
%K nonn,base,easy
%O 1,1
%A _Amarnath Murthy_, Jun 27 2001
%E Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jul 06 2001
%E Offset corrected by _Mohammed Yaseen_, Jul 28 2022
|