OFFSET
1,3
FORMULA
EXAMPLE
The twelfth prime is 37, with next prime-power 41, so a(12) = 4.
MATHEMATICA
Table[NestWhile[#+1&, Prime[n]+1, !PrimePowerQ[#]&]-Prime[n], {n, 100}]
PROG
(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
CROSSREFS
For prime instead of prime-power we have A001223.
This is the restriction of A377282 to the prime numbers.
A000015 gives the least prime-power >= n.
A031218 gives the greatest prime-power <= n.
A246655 lists the prime-powers not including 1.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Oct 23 2024
STATUS
approved