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
LINKS
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
KEYWORD
nonn,changed
AUTHOR
Zak Seidov, Oct 07 2002
STATUS
approved