login
A377289
Difference between prime(n) and the previous prime-power (exclusive).
10
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,4
FORMULA
a(n) = prime(n) - A031218(prime(n)-1).
a(n) = prime(n) - A065514(n).
a(n) = A276781(prime(n)-1).
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 powers of two see A013597, A014210, A014234, A244508, A304521.
For prime instead of prime-power we have A075526.
This is the restriction of A276781 (shifted right) to the primes.
For next instead of previous prime-power we have A377281, restriction of A377282.
A000015 gives the least prime-power >= n.
A000040 lists the primes, differences A001223.
A000961 lists the powers of primes, differences A057820, complement A361102.
A031218 gives the greatest prime-power <= n.
A065514 gives the greatest prime-power < prime(n).
A080101 counts prime-powers between primes (exclusive), cf. A377286, A377287, A377288.
A246655 lists the prime-powers not including 1.
Sequence in context: A361913 A253196 A353981 * A271205 A303841 A093116
KEYWORD
nonn
AUTHOR
Gus Wiseman, Oct 23 2024
STATUS
approved