%I #36 Mar 24 2024 04:27:03
%S 1,12,13,114,115,123,131,141,151,212,231,1122,1611,1911,2121,3211,
%T 3311,11124,11215,11251,11421,12114,12311,12411,13121,14121,14211,
%U 15211,21114,21212,21221,21411,22121,22211,26111,52111,111118,111119,111133,111142,111241
%N Numbers whose product of decimal digits = sum of binary digits.
%C The number of terms with d digits, for d = 1,...,20 is 1, 2, 8, 6, 19, 37, 49, 95, 152, 240, 374, 528, 748, 1174, 1607, 2415, 3309, 4687, 7202, 9357. - _Giovanni Resta_, Mar 28 2013
%H Harry J. Smith and Donovan Johnson, <a href="/A064003/b064003.txt">Table of n, a(n) for n = 1..1000</a> (first 200 terms from Harry J. Smith)
%F { k : A000120(k) = A007954(k) }.
%e Product of digits of 15211 is 10, 15211 = 11101101101011 in binary with 10 "1's", hence 15211 is in the sequence.
%t Select[Range[120000],Times@@IntegerDigits[#]==Total[ IntegerDigits[#,2]]&] (* _Harvey P. Dale_, Mar 01 2012 *)
%t (* dig[x] generates all terms with x digits *) dig[nd_] := Block[{dec, w}, dec[p_, n_] := If[Length@p == nd, n==1 && AppendTo[w, p], Do[If[Mod[n, x] == 0, dec[Append[p, x], n/x]], {x, Max[Max@p, 1], 9}]]; Sort@Flatten@Table[w = {}; dec[{}, nb]; Select[FromDigits /@ Flatten[Permutations /@ w, 1], Total@ IntegerDigits[#, 2] == nb &], {nb, Ceiling@Log[2, 10^nd]}]]; (* _Giovanni Resta_, Mar 28 2013 *)
%o (PARI) for(n=1,120000,s=ceil(log(n)/log(10)); b=binary(n);l=length(b); if(sum(i=1,l, component(b,i))==prod(i=0,s-1,floor(n/10^i)-10*floor(n/10^(i+1))),print1(n,",")))
%o (PARI) ProdD(x)= { local(p); p=1; while (x>9 && p>0, p*=(x-10*(x\10)); x\=10); return(p*x) }
%o SumBD(x)= { local(b); b=binary(x); sum(i=1, length(b), b[i]) }
%o { n=0; for (m=1, 10^9, if ((p=ProdD(m))>0 && p==SumBD(m), write("b064003.txt", n++, " ", m); if (n==200, break)) ) } \\ _Harry J. Smith_, Sep 05 2009
%Y Subsequence of A052382.
%K nonn,base
%O 1,2
%A _Benoit Cloitre_, Jun 05 2002