A288507 Least number k such that both prime(k+1) -/+ prime(k) are products of n prime factors (counting multiplicity).
24, 319, 738, 57360, 1077529, 116552943
Offset: 3
Examples
n = 8: k = 116552943, p = prime(k) = 2394261637, q = prime(k+1) = 2394261893; both q-p = 2^8 and p+q = 2*3^2*5*7^3*155119 are 8-almost primes (A046310).
Programs
-
PARI
a(n) = my(k = 1, p = 2, q = nextprime(p+1)); while((bigomega(p+q)!= n) || (bigomega(p-q)!= n), k++; p = q; q = nextprime(p+1)); k; \\ Michel Marcus, Jul 24 2017
-
Python
from sympy import factorint, nextprime def A288507(n): k, p, q = 1, 2, 3 while True: if sum(factorint(q-p).values()) == n and sum(factorint(q+p).values()) == n: return k k += 1 p, q = q, nextprime(q) # Chai Wah Wu, Jul 23 2017
Comments