login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A124284
Prime(4almostprime(n))-4almostprime(prime(n)). Commutator [A000040,A014613] at n.
8
29, 53, 97, 113, 161, 159, 145, 269, 244, 232, 231, 247, 261, 373, 399, 386, 328, 350, 375, 371, 395, 547, 559, 572, 537, 541, 577, 635, 679, 663, 607, 621, 687, 673, 658, 769, 871, 853, 839, 856, 832, 881, 947, 939, 1003, 1007, 955, 915, 907, 889, 941, 989
OFFSET
1,1
LINKS
Robert G. Wilson v, Table of n, a(n) for n=1..1000
FORMULA
a(n) = prime(4almostprime(n)) - 4almostprime(prime(n)) = A000040(A014613(n)) -A014613(A000040(n)).
EXAMPLE
a(1) = prime(4almostprime(1)) - 4almostprime(prime(1)) = 53 - 24 = 29.
a(2) = prime(4almostprime(2)) - 4almostprime(prime(2)) = 89 - 36 = 53.
a(3) = prime(4almostprime(3)) - 4almostprime(prime(3)) = 151 - 54 = 97.
It is mere coincidence that the first 4 values are all primes.
MATHEMATICA
FourAlmostPrimePi[n_] := Sum[PrimePi[n/(Prime@i*Prime@j*Prime@k)] - k + 1, {i, PrimePi[n^(1/4)]}, {j, i, PrimePi[(n/Prime@i)^(1/3)]}, {k, j, PrimePi@ Sqrt[n/(Prime@i*Prime@j)]}];
FourAlmostPrime[n_] := Block[{e = Floor[Log[2, n] + 1], a, b}, a = 2^e; Do[b = 2^p; While[ FourAlmostPrimePi@a < n, a = a + b]; a = a - b/2, {p, e, 0, -1}]; a + b/2];
Table[ Prime@ FourAlmostPrime@ n - FourAlmostPrime@ Prime@ n, {n, 52}]
PROG
(Python)
from math import isqrt
from sympy import primepi, primerange, integer_nthroot, prime
def A124284(n):
def f(x): return int(x-sum(primepi(x//(k*m*r))-c for a, k in enumerate(primerange(integer_nthroot(x, 4)[0]+1)) for b, m in enumerate(primerange(k, integer_nthroot(x//k, 3)[0]+1), a) for c, r in enumerate(primerange(m, isqrt(x//(k*m))+1), b)))
m, k = n, f(n)+n
while m != k:
m, k = k, f(k)+n
r, k = (p:=prime(n)), f(p)+p
while r != k:
r, k = k, f(k)+p
return prime(m)-r # Chai Wah Wu, Aug 17 2024
CROSSREFS
Cf. Primes indexed by 4-almost primes = A124282. 4-almost primes indexed by primes = A124283. 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)).
Sequence in context: A274227 A230027 A105406 * A054822 A034847 A139925
KEYWORD
easy,nonn
AUTHOR
Jonathan Vos Post, Oct 24 2006
EXTENSIONS
More terms from Robert G. Wilson v, Aug 31 2007
STATUS
approved