A377282 Difference between n and the next prime-power (exclusive).
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
Keywords
Examples
The next prime-power after 13 is 16, so a(12) = 3.
Crossrefs
Programs
-
Mathematica
Table[NestWhile[#+1&,n+1,!PrimePowerQ[#]&]-n,{n,100}]
-
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