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.

A069584 a(n) = n - largest perfect power <= n.

Original entry on oeis.org

0, 1, 2, 0, 1, 2, 3, 0, 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 0, 1, 2, 3, 4, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
Offset: 1

Views

Author

Amarnath Murthy, Mar 24 2002

Keywords

Comments

a(n) = 0 if n = m^p that is if n is a full power (square, cube etc.).
As Catalan's conjecture is now proved, n=8=2^3, n+1=9=3^2 is the only solution for a(n+1) = a(n) = 0.

Crossrefs

Cf. A001597, a(n)=n-A081676(n).

Programs

  • Maple
    N:= 100: # for a(1) .. a(N), where N is a perfect power
    S:= {seq(seq(i^p,i=1.. floor(N^(1/p))),p=2..ilog2(N))}:
    P:= sort(convert(S,list)):
    A:= [seq(seq(i-P[j],i=P[j]..P[j+1]-1),j=1..nops(P)-1),0]; # Robert Israel, Apr 04 2025
  • PARI
    a(n) = {m = n; while(!ispower(m), m--; if (m==0, return (n-1))); n-m;} \\ Michel Marcus, Nov 04 2015

Extensions

Edited by Reinhard Zumkeller, Mar 26 2003