A377281 Difference between the n-th prime and the next prime-power (exclusive).
1, 1, 2, 1, 2, 3, 2, 4, 2, 2, 1, 4, 2, 4, 2, 6, 2, 3, 4, 2, 6, 2, 6, 8, 4, 2, 4, 2, 4, 8, 1, 6, 2, 10, 2, 6, 6, 4, 2, 6, 2, 10, 2, 4, 2, 12, 12, 4, 2, 4, 6, 2, 2, 5, 6, 6, 2, 6, 4, 2, 6, 14, 4, 2, 4, 14, 6, 6, 2, 4, 6, 2, 6, 6, 4, 6, 8, 4, 8, 10, 2, 10, 2, 6
Offset: 1
Keywords
Examples
The twelfth prime is 37, with next prime-power 41, so a(12) = 4.
Crossrefs
Programs
-
Mathematica
Table[NestWhile[#+1&,Prime[n]+1,!PrimePowerQ[#]&]-Prime[n],{n,100}]
-
Python
from itertools import count from sympy import prime, factorint def A377281(n): return -(p:=prime(n))+next(filter(lambda m:len(factorint(m))<=1, count(p+1))) # Chai Wah Wu, Oct 25 2024