OFFSET
1,1
COMMENTS
Semiprime analog of A036454: prime powers with special exponents: q^(p-1) where both p and q are arbitrary prime numbers.
FORMULA
EXAMPLE
a(1) = smallest semiprime to power of (smallest semiprime - 1) = 4^(4-1) = 4^3 = 64.
PROG
(Python)
from math import isqrt
from sympy import primepi, primerange, integer_nthroot, factorint
def A186637(n):
def A072000(n): return int(-((t:=primepi(s:=isqrt(n)))*(t-1)>>1)+sum(primepi(n//p) for p in primerange(s+1)))
def f(x): return int(n+x-sum(A072000(integer_nthroot(x, p-1)[0]) for p in range(4, x.bit_length()+1) if sum(factorint(p).values())==2))
def bisection(f, kmin=0, kmax=1):
while f(kmax) > kmax: kmax <<= 1
while kmax-kmin > 1:
kmid = kmax+kmin>>1
if f(kmid) <= kmid:
kmax = kmid
else:
kmin = kmid
return kmax
return bisection(f, n, n) # Chai Wah Wu, Sep 12 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Jonathan Vos Post, Feb 24 2011
STATUS
approved