cp's OEIS Frontend

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.

A074984 m^p-n, for smallest m^p>=n.

Original entry on oeis.org

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

Views

Author

Zak Seidov, Oct 07 2002

Keywords

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

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.

Programs

  • 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 *)
  • PARI
    a(n) = { if (n==1, return (0)); my(nn = n); while(! ispower(nn), nn++); return (nn - n);} \\ Michel Marcus, Apr 19 2013

Formula

a(n) = A377468(n) - n. - Gus Wiseman, Dec 02 2024