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”).

A074984
m^p-n, for smallest m^p>=n.
9
0, 2, 1, 0, 3, 2, 1, 0, 0, 6, 5, 4, 3, 2, 1, 0, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 0, 4, 3, 2, 1, 0, 3, 2, 1, 0, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8
OFFSET
1,2
COMMENTS
a(n) = 0 if n = m^p that is if n is a full power (square, cube etc.).
This is the distance between n and the next perfect power. The previous perfect power is A081676, which differs from n by A069584. After a(8) = a(9) this sequence is an anti-run (no adjacent equal terms). - Gus Wiseman, Dec 02 2024
FORMULA
a(n) = A377468(n) - n. - Gus Wiseman, Dec 02 2024
MATHEMATICA
powerQ[n_] := GCD @@ FactorInteger[n][[All, 2]] > 1; powerQ[1] = True; a[n_] := For[k = n, True, k++, If[powerQ[k], Return[k-n]]]; Table[a[n], {n, 1, 92}] (* Jean-François Alcover, Apr 19 2013 *)
PROG
(PARI) a(n) = { if (n==1, return (0)); my(nn = n); while(! ispower(nn), nn++); return (nn - n); } \\ Michel Marcus, Apr 19 2013
CROSSREFS
Sequences obtained by subtracting n from each term are placed in parentheses below.
Positions of 0 are A001597.
Positions of 1 are A375704.
The version for primes is A007920 (A007918).
The opposite (greatest perfect power <= n) is A069584 (A081676).
The version for perfect powers is A074984 (this) (A377468).
The version for squarefree numbers is A081221 (A067535).
The version for non perfect powers is A378357 (A378358).
The version for nonsquarefree numbers is A378369 (A120327).
The version for prime powers is A378370 (A000015).
The version for non prime powers is A378371 (A378372).
A001597 lists the perfect powers, differences A053289.
A007916 lists the non perfect powers, differences A375706.
A069623 counts perfect powers <= n.
A076411 counts perfect powers < n.
A131605 lists perfect powers that are not prime powers.
A377432 counts perfect powers between primes, zeros A377436.
Sequence in context: A291895 A177351 A117901 * A112658 A190693 A257571
KEYWORD
nonn,changed
AUTHOR
Zak Seidov, Oct 07 2002
STATUS
approved