A378371 Distance between n and the least non prime power >= n, allowing 1.
0, 4, 3, 2, 1, 0, 3, 2, 1, 0, 1, 0, 1, 0, 0, 2, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 2, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0
Offset: 1
Keywords
Examples
The least non prime power >= 4 is 6, so a(4) = 2.
Crossrefs
Sequences obtained by adding n to each term are placed in parentheses below.
For nonsquarefree we have (A120327).
Programs
-
Mathematica
Table[NestWhile[#+1&,n,PrimePowerQ[#]&]-n,{n,100}]
Formula
a(n) = A378372(n) - n.
Comments