A069584 a(n) = n - largest perfect power <= n.
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
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
- Eric Weisstein's World of Mathematics, Catalan's conjecture
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
Comments