login
A106423
Smallest number beginning with 3 and having exactly n prime divisors counted with multiplicity.
2
3, 33, 30, 36, 32, 324, 320, 384, 3200, 3456, 3072, 31104, 30720, 36864, 32768, 331776, 327680, 393216, 3276800, 3538944, 3145728, 31850496, 31457280, 37748736, 33554432, 339738624, 301989888, 3057647616, 3019898880, 3623878656
OFFSET
1,1
LINKS
EXAMPLE
a(1) = 3, a(6) = 324 = 2^2*3^4.
MAPLE
f:= proc(n) uses priqueue; local pq, t, p, x, i;
initialize(pq);
insert([-2^n, 2$n], pq);
do
t:= extract(pq);
x:= -t[1];
if floor(x/10^ilog10(x)) = 3 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..50]); # Robert Israel, Sep 06 2024
PROG
(Python)
from itertools import count
from math import isqrt, prod
from sympy import primerange, integer_nthroot, primepi
def A106423(n):
if n == 1: return 3
def g(x, a, b, c, m): yield from (((d, ) for d in enumerate(primerange(b, isqrt(x//c)+1), a)) if m==2 else (((a2, b2), )+d for a2, b2 in enumerate(primerange(b, integer_nthroot(x//c, m)[0]+1), a) for d in g(x, a2, b2, c*b2, m-1)))
def f(x): return int(sum(primepi(x//prod(c[1] for c in a))-a[-1][0] for a in g(x, 0, 1, 1, n)))
for l in count(len(str(1<<n))-1):
kmin, kmax = 3*10**l-1, 4*10**l-1
mmin, mmax = f(kmin), f(kmax)
if mmax>mmin:
while kmax-kmin > 1:
kmid = kmax+kmin>>1
mmid = f(kmid)
if mmid > mmin:
kmax, mmax = kmid, mmid
else:
kmin, mmin = kmid, mmid
return kmax # Chai Wah Wu, Sep 12 2024
KEYWORD
base,nonn
AUTHOR
Ray Chandler, May 02 2005
STATUS
approved