This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A074984 #18 Dec 04 2024 10:16:28 %S A074984 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, %T A074984 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, %U A074984 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 %N A074984 m^p-n, for smallest m^p>=n. %C A074984 a(n) = 0 if n = m^p that is if n is a full power (square, cube etc.). %C A074984 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 %H A074984 Wikipedia, <a href="https://en.wikipedia.org/wiki/Catalan%27s_conjecture">Catalan's conjecture</a> %F A074984 a(n) = A377468(n) - n. - _Gus Wiseman_, Dec 02 2024 %t A074984 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 *) %o A074984 (PARI) a(n) = { if (n==1, return (0)); my(nn = n); while(! ispower(nn), nn++); return (nn - n);} \\ _Michel Marcus_, Apr 19 2013 %Y A074984 Sequences obtained by subtracting n from each term are placed in parentheses below. %Y A074984 Positions of 0 are A001597. %Y A074984 Positions of 1 are A375704. %Y A074984 The version for primes is A007920 (A007918). %Y A074984 The opposite (greatest perfect power <= n) is A069584 (A081676). %Y A074984 The version for perfect powers is A074984 (this) (A377468). %Y A074984 The version for squarefree numbers is A081221 (A067535). %Y A074984 The version for non perfect powers is A378357 (A378358). %Y A074984 The version for nonsquarefree numbers is A378369 (A120327). %Y A074984 The version for prime powers is A378370 (A000015). %Y A074984 The version for non prime powers is A378371 (A378372). %Y A074984 A001597 lists the perfect powers, differences A053289. %Y A074984 A007916 lists the non perfect powers, differences A375706. %Y A074984 A069623 counts perfect powers <= n. %Y A074984 A076411 counts perfect powers < n. %Y A074984 A131605 lists perfect powers that are not prime powers. %Y A074984 A377432 counts perfect powers between primes, zeros A377436. %Y A074984 Cf. A014210, A023055, A045542, A052410, A076412, A151800, A188951, A216765. %K A074984 nonn %O A074984 1,2 %A A074984 _Zak Seidov_, Oct 07 2002