login
Zerofree numbers having product of digits less than or equal to sum of digits.
4

%I #38 Jun 29 2019 11:54:30

%S 1,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,21,22,31,41,51,61,71,81,

%T 91,111,112,113,114,115,116,117,118,119,121,122,123,131,132,141,151,

%U 161,171,181,191,211,212,213,221,231,311,312,321,411

%N Zerofree numbers having product of digits less than or equal to sum of digits.

%C Intersection of A052382 and A062996.

%C The repunit A002275(k), for k >= 2, appears at position A254622(k-1) + 1. - _Wolfdieter Lang_, Feb 23 2015

%H David A. Corneth, <a href="/A254621/b254621.txt">Table of n, a(n) for n = 1..10000</a>

%p extend:= proc(t, b, d)

%p local i,j,m,s,p;

%p p:= t[2];

%p s:= t[3];

%p if s = 0 then if b=2 then j:= 3 else j:= 2 fi

%p else for j from 0 to d-nops(t[1]) while p*b^j <= s + j*b do od

%p fi:

%p seq([[op(t[1]),b$i],p*b^i,s+i*b],i=0..j-1);

%p end proc:

%p f:= proc(d)

%p local j, b, Res;

%p Res:= [seq([[1$j],1,j],j=0..d)];

%p for b from 2 to 9 do

%p Res:= map(extend,Res,b,d)

%p od:

%p Res:= map(t -> op(combinat:-permute(t[1])),Res);

%p subs(0=NULL,sort(map(t -> add(t[i]*10^(i-1),i=1..nops(t)), Res)));

%p end proc:

%p f(5); # _Robert Israel_, May 19 2015

%t m[w_] := Flatten@Table[i, {i,9}, {w[[i]]}]; a[upd_] := Union@ Flatten@ Table[ FromDigits /@ Flatten[Permutations /@ m /@ Select[ Flatten[ Permutations /@ (IntegerPartitions[d + 9, {9}, Range[d + 1]] - 1), 1], Times @@ (Range[9]^#) <= Total[# Range[9]] &], 1], {d, upd}]; a[12] (* terms with up to 12 digits, _Giovanni Resta_, May 19 2015 *)

%t zfnQ[n_]:=Module[{idn=IntegerDigits[n]},FreeQ[idn,0]&&Times@@idn <= Total[ idn]]; Select[Range[500],zfnQ] (* _Harvey P. Dale_, Jun 29 2019 *)

%o (PARI) is(n)={my(d=digits(n));my(p=prod(i=1,#d,d[i])); 0 < p && p<=vecsum(d) } \\ _David A. Corneth_, May 15 2015

%Y Cf. A052382, A062996, A062997, A062998, A062999, A254622, A002275.

%K nonn,base

%O 1,2

%A _David A. Corneth_, Feb 03 2015