cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A124284 Prime(4almostprime(n))-4almostprime(prime(n)). Commutator [A000040,A014613] at n.

This page as a plain text file.
%I A124284 #12 Aug 17 2024 14:19:26
%S A124284 29,53,97,113,161,159,145,269,244,232,231,247,261,373,399,386,328,350,
%T A124284 375,371,395,547,559,572,537,541,577,635,679,663,607,621,687,673,658,
%U A124284 769,871,853,839,856,832,881,947,939,1003,1007,955,915,907,889,941,989
%N A124284 Prime(4almostprime(n))-4almostprime(prime(n)). Commutator [A000040,A014613] at n.
%H A124284 Robert G. Wilson v, <a href="/A124284/b124284.txt">Table of n, a(n) for n=1..1000</a>
%F A124284 a(n) = prime(4almostprime(n)) - 4almostprime(prime(n)) = A000040(A014613(n)) -A014613(A000040(n)).
%e A124284 a(1) = prime(4almostprime(1)) - 4almostprime(prime(1)) = 53 - 24 = 29.
%e A124284 a(2) = prime(4almostprime(2)) - 4almostprime(prime(2)) = 89 - 36 = 53.
%e A124284 a(3) = prime(4almostprime(3)) - 4almostprime(prime(3)) = 151 - 54 = 97.
%e A124284 It is mere coincidence that the first 4 values are all primes.
%t A124284 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)]}];
%t A124284 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];
%t A124284 Table[ Prime@ FourAlmostPrime@ n - FourAlmostPrime@ Prime@ n, {n, 52}]
%o A124284 (Python)
%o A124284 from math import isqrt
%o A124284 from sympy import primepi, primerange, integer_nthroot, prime
%o A124284 def A124284(n):
%o A124284     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)))
%o A124284     m, k = n, f(n)+n
%o A124284     while m != k:
%o A124284         m, k = k, f(k)+n
%o A124284     r, k = (p:=prime(n)), f(p)+p
%o A124284     while r != k:
%o A124284         r, k = k, f(k)+p
%o A124284     return prime(m)-r # _Chai Wah Wu_, Aug 17 2024
%Y A124284 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)).
%Y A124284 Cf. A000040, A014613, A114414, A122824, A124269, A124270, A124282, A124283.
%K A124284 easy,nonn
%O A124284 1,1
%A A124284 _Jonathan Vos Post_, Oct 24 2006
%E A124284 More terms from _Robert G. Wilson v_, Aug 31 2007