A377289 Difference between prime(n) and the previous prime-power (exclusive).
1, 1, 1, 2, 2, 2, 1, 2, 4, 2, 2, 5, 4, 2, 4, 4, 6, 2, 3, 4, 2, 6, 2, 6, 8, 4, 2, 4, 2, 4, 2, 3, 6, 2, 10, 2, 6, 6, 4, 4, 6, 2, 10, 2, 4, 2, 12, 12, 4, 2, 4, 6, 2, 8, 1, 6, 6, 2, 6, 4, 2, 4, 14, 4, 2, 4, 14, 6, 4, 2, 4, 6, 6, 6, 6, 4, 6, 8, 4, 8, 10, 2, 10, 2
Offset: 1
Keywords
Examples
The twelfth prime is 37, with previous prime-power 32, so a(12) = 5.
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.
Programs
-
Mathematica
Table[Prime[n]-NestWhile[#-1&, Prime[n]-1,#>1&&!PrimePowerQ[#]&],{n,100}]
-
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