OFFSET
1,4
FORMULA
EXAMPLE
The twelfth prime is 37, with previous prime-power 32, so a(12) = 5.
MATHEMATICA
Table[Prime[n]-NestWhile[#-1&, Prime[n]-1, #>1&&!PrimePowerQ[#]&], {n, 100}]
PROG
(Python)
from sympy import prime, factorint
def A377289(n): return (p:=prime(n))-next(filter(lambda m:len(factorint(m))<=1, range(p-1, 0, -1))) # Chai Wah Wu, Oct 25 2024
CROSSREFS
For prime instead of prime-power we have A075526.
This is the restriction of A276781 (shifted right) to the primes.
A000015 gives the least prime-power >= n.
A031218 gives the greatest prime-power <= n.
A065514 gives the greatest prime-power < prime(n).
A246655 lists the prime-powers not including 1.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Oct 23 2024
STATUS
approved