OFFSET
1,1
COMMENTS
The difference d = P(n) - k is also coprime to P(n), and satisfies d < prime(n+1)^2, which means it must be prime since composite d would have at least one prime factor <= prime(n).
There is always at least one prime strictly between prime(n) and prime(n+1)^2, consequently d is the largest prime < prime(n+1)^2, and so a(n) = A002110(n) - A054270(n+1).
There are no negative terms after a(3).
LINKS
Jakub Buczak and Antony Theodorakopoulos, How primorials can be used to generate primes.
EXAMPLE
a(4) = 97, since 2*3*5*7 - 11^2 = 89, the smallest number coprime to 2*3*5*7 greater than 89 is 97.
a(2) = -17, since 2*3 - 5^2 = -19, the smallest number x>-19 coprime here is thus -17, and its difference d = 30 -(-17) = 47 is the largest prime < 7^2.
PROG
(PARI) a(n) = my(P=vecprod(primes(n)), k=P-prime(n+1)^2+1); while (gcd(k, P)!=1, k++); k; \\ Michel Marcus, Apr 07 2025
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Jakub Buczak, Apr 06 2025
STATUS
approved
