login
A074984
m^p-n, for smallest m^p>=n.
0
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.).
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
Sequence in context: A291895 A177351 A117901 * A112658 A190693 A257571
KEYWORD
nonn
AUTHOR
Zak Seidov, Oct 07 2002
STATUS
approved