%I #14 Feb 10 2018 22:01:21
%S 1,4,6,8,9,22,123,132,213,231,312,321,1124,1142,1214,1241,1412,1421,
%T 2114,4112,4121,11125,11133,11152,11215,11222,11313,11331,11512,11521,
%U 12115,12122,12151,12212,12221,13113,13131,13311,15112,15211,21115
%N Nonprimes such that sum of digits equals product of digits.
%H Chai Wah Wu, <a href="/A066307/b066307.txt">Table of n, a(n) for n = 1..10000</a> (n = 1..516 from Harry J. Smith)
%e 321 = 3*107, 3 + 2 + 1 = 6 = 3*2*1.
%t sdpdQ[n_]:=Module[{idn=IntegerDigits[n]},Total[idn]==Times@@idn]; Module[ {upto=25000, cs},cs=Complement[Range[upto],Prime[Range[PrimePi[upto]]]];Select[cs,sdpdQ]] (* _Harvey P. Dale_, Oct 14 2014 *)
%o (PARI) SumD(x)= { local(s=0); while (x>9, s+=x%10; x\=10); return(s + x) } ProdD(x)= { local(p=1); while (x>9 && p>0, p*=x%10; x\=10); return(p*x) } { n=0; for (m=1, 10^9, if (isprime(m), next); if (SumD(m)==ProdD(m), write("b066307.txt", n++, " ", m); if (n==1000, return)) ) } \\ _Harry J. Smith_, Feb 09 2010
%Y Composites and 1 from A034710.
%Y Cf. A034710, A066306.
%K base,nonn
%O 1,2
%A _Labos Elemer_, Dec 13 2001
|