OFFSET
1,1
EXAMPLE
a(4) = 81 because 81 has sum of digits 9, both 81 = 3^4 and 81 + 9 = 90 = 2 * 3^2 * 5 have 4 prime divisors, counted with multiplicity, and no number smaller than 81 works.
MAPLE
f:= proc(n) uses priqueue; local pq, t, x, s, p, i;
initialize(pq);
insert([-2^n, 2$n], pq);
do
t:= extract(pq);
x:= -t[1];
s:= convert(convert(x, base, 10), `+`);
if numtheory:-bigomega(x+s) = n then return x fi;
p:= nextprime(t[-1]);
for i from n+1 to 2 by -1 while t[i] = t[-1] do
insert([t[1]*(p/t[-1])^(n+2-i), op(t[2..i-1]), p$(n+2-i)], pq)
od;
od;
end proc:
map(f, [$1..20]);
PROG
(PARI)
generate(A, B, n, k) = A=max(A, 2^n); (f(m, p, n) = my(list=List()); if(n==1, forprime(q=max(p, ceil(A/m)), B\m, if(bigomega(m*q+sumdigits(m*q)) == k, listput(list, m*q))), forprime(q=p, sqrtnint(B\m, n), list=concat(list, f(m*q, q, n-1)))); list); vecsort(Vec(f(1, 2, n)));
a(n) = my(x=2^n, y=2*x); while(1, my(v=generate(x, y, n, n)); if(#v >= 1, return(v[1])); x=y+1; y=2*x); \\ Daniel Suteu, May 24 2025
CROSSREFS
KEYWORD
nonn,base,hard
AUTHOR
Robert Israel, May 06 2025
EXTENSIONS
a(21)-a(22) from Michael S. Branicky, May 08 2025
a(23)-a(25) from Daniel Suteu, May 24 2025
STATUS
approved
