OFFSET
1,1
EXAMPLE
a(1) = 3almostprime(semiprime(1)) = 3almostprime(4 = 2^2) = 20 = 2^2 * 5.
a(2) = 3almostprime(semiprime(2)) = 3almostprime(6 = 2 * 3) = 28 = 2^2 * 7.
a(3) = 3almostprime(semiprime(3)) = 3almostprime(9 = 3^2) = 44 = 2^2 * 11.
a(4) = 3almostprime(semiprime(4)) = 3almostprime(10 = 2 * 5) = 45 = 3^2 * 5.
MATHEMATICA
p[k_] := Select[Range[1000], PrimeOmega[#] == k &]; p[3][[Take[p[2], 60]]] (* Giovanni Resta, Jun 13 2016 *)
PROG
(Python)
from math import isqrt
from sympy import primepi, primerange, integer_nthroot
def A124318(n):
def g(x): return int(x-sum(primepi(x//(k*m))-b for a, k in enumerate(primerange(integer_nthroot(x, 3)[0]+1)) for b, m in enumerate(primerange(k, isqrt(x//k)+1), a)))
def f(x): return int(x+((t:=primepi(s:=isqrt(x)))*(t-1)>>1)-sum(primepi(x//k) for k in primerange(1, s+1)))
m, k = n, f(n)+n
while m != k:
m, k = k, f(k)+n
r, k = m, g(m)+m
while r != k:
r, k = k, g(k)+m
return r # Chai Wah Wu, Aug 17 2024
CROSSREFS
Cf. A124317 Semiprimes indexed by 3-almost primes. A124318 3-almost primes indexed by semiprimes. A124319 semiprime(3almostprime(n)) - 3almostprime(semiprime(n)). A124308 Primes indexed by 5-almost primes. A124309 5-almost primes indexed by primes. A124310 prime(5almostprime(n)) - 5almostprime(prime(n)). 4-almost primes indexed by primes = A124283. prime(4almostprime(n)) - 4almostprime(prime(n)) = A124284. Primes indexed by 3-almost primes = A124268. 3-almost primes indexed by primes = A124269. prime(3almostprime(n)) - 3almostprime(prime(n)) = A124270. See also A106349 Primes indexed by semiprimes. See also A106350 Semiprimes indexed by primes. See also A122824 Prime(semiprime(n)) - semiprime(prime(n)). Commutator [A000040, A001358] at n.
KEYWORD
easy,nonn,less
AUTHOR
Jonathan Vos Post, Oct 26 2006
EXTENSIONS
a(22)-a(53) from Giovanni Resta, Jun 13 2016
STATUS
approved