A254621 Zerofree numbers having product of digits less than or equal to sum of digits.
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, 91, 111, 112, 113, 114, 115, 116, 117, 118, 119, 121, 122, 123, 131, 132, 141, 151, 161, 171, 181, 191, 211, 212, 213, 221, 231, 311, 312, 321, 411
Offset: 1
Links
- David A. Corneth, Table of n, a(n) for n = 1..10000
Programs
-
Maple
extend:= proc(t, b, d) local i,j,m,s,p; p:= t[2]; s:= t[3]; if s = 0 then if b=2 then j:= 3 else j:= 2 fi else for j from 0 to d-nops(t[1]) while p*b^j <= s + j*b do od fi: seq([[op(t[1]),b$i],p*b^i,s+i*b],i=0..j-1); end proc: f:= proc(d) local j, b, Res; Res:= [seq([[1$j],1,j],j=0..d)]; for b from 2 to 9 do Res:= map(extend,Res,b,d) od: Res:= map(t -> op(combinat:-permute(t[1])),Res); subs(0=NULL,sort(map(t -> add(t[i]*10^(i-1),i=1..nops(t)), Res))); end proc: f(5); # Robert Israel, May 19 2015
-
Mathematica
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 *) zfnQ[n_]:=Module[{idn=IntegerDigits[n]},FreeQ[idn,0]&&Times@@idn <= Total[ idn]]; Select[Range[500],zfnQ] (* Harvey P. Dale, Jun 29 2019 *)
-
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
Comments