OFFSET
1,1
EXAMPLE
a(3) = 1113 because 1113 contains 3 1's and 1113 = 3 * 7 * 53 has 3 prime factors, counted with multiplicity.
MAPLE
g:= proc(x, S, d)
local L, i;
L:= convert(x, base, 9);
add(`if`(L[i]=0, 0, L[i]+1)*10^S[i], i=1..nops(L)) + add(10^i, i={$0..d-1} minus S)
end proc:
f:= proc(n)
local x, d, Cands, S;
x:= (10^n-1)/9;
if numtheory:-bigomega(x) = n then return x fi;
for d from n+1 do
Cands:= sort([seq(seq(g(x, S, d), x =9^(d-n-1) .. 9^(d-n)-1), S = combinat:-choose({$0..d-1}, d-n))]);
for x in Cands do if numtheory:-bigomega(x) = n then return x fi od;
od;
end proc:
seq(f(i), i=1..19);
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Robert Israel, Sep 12 2024
STATUS
approved