login
A377282
Difference between n and the next prime-power (exclusive).
26
1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 2, 1, 3, 2, 1, 1, 2, 1, 4, 3, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 1, 5, 4, 3, 2, 1, 4, 3, 2, 1, 2, 1, 4, 3, 2, 1, 2, 1, 4, 3, 2, 1, 6, 5, 4, 3, 2, 1, 2, 1, 3, 2, 1, 3, 2, 1, 4, 3, 2, 1, 2, 1, 6, 5, 4, 3, 2, 1, 2, 1, 2, 1, 6, 5, 4, 3, 2
OFFSET
1,5
FORMULA
a(n) = A000015(n) - n + 1 for n > 1.
a(prime(n)) = A377281(n).
EXAMPLE
The next prime-power after 13 is 16, so a(12) = 3.
MATHEMATICA
Table[NestWhile[#+1&, n+1, !PrimePowerQ[#]&]-n, {n, 100}]
PROG
(Python)
from itertools import count
from sympy import factorint
def A377282(n): return next(filter(lambda m:len(factorint(m))<=1, count(n+1)))-n # Chai Wah Wu, Oct 25 2024
CROSSREFS
For powers of 2 see A013597, A014210, A014234, A244508, A304521.
For prime instead of prime-power we have A013632.
For previous instead of next prime-power we have A276781, restriction A377289.
The restriction to the prime numbers is A377281.
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.
A080101 counts prime-powers between primes (exclusive), cf. A377286, A377287, A377288.
Sequence in context: A380441 A136755 A156775 * A064693 A325614 A361746
KEYWORD
nonn
AUTHOR
Gus Wiseman, Oct 23 2024
STATUS
approved