login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A097106
a(n) = (Smallest prime power >= n) - (greatest prime power <= n).
2
0, 0, 0, 0, 0, 2, 0, 0, 0, 2, 0, 2, 0, 3, 3, 0, 0, 2, 0, 4, 4, 4, 0, 2, 0, 2, 0, 2, 0, 2, 0, 0, 5, 5, 5, 5, 0, 4, 4, 4, 0, 2, 0, 4, 4, 4, 0, 2, 0, 4, 4, 4, 0, 6, 6, 6, 6, 6, 0, 2, 0, 3, 3, 0, 3, 3, 0, 4, 4, 4, 0, 2, 0, 6, 6, 6, 6, 6, 0, 2, 0, 2, 0, 6, 6, 6, 6, 6, 0, 8, 8, 8, 8, 8, 8, 8, 0, 4, 4, 4, 0, 2, 0, 4, 4
OFFSET
1,6
LINKS
FORMULA
a(n) = A000015(n) - A031218(n);
a(n) = 0 iff n is a power of a prime (in A000961).
MATHEMATICA
sp[n_] := If[n == 1, 1, Module[{m = n}, While[!PrimePowerQ[m], m++]; m]];
gp[n_] := If[n == 1, 1, Module[{m = n}, While[!PrimePowerQ[m], m--]; m]];
a[n_] := sp[n] - gp[n];
Array[a, 100] (* Jean-François Alcover, Dec 02 2021 *)
PROG
(PARI)
A000015(n) = if(1==n, n, while(!isprimepower(n), n++); n);
A031218(n) = if(1==n, n, while(!isprimepower(n), n--); n);
A097106(n) = (A000015(n) - A031218(n)); \\ Antti Karttunen, Sep 23 2018
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Reinhard Zumkeller, Sep 15 2004
STATUS
approved