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.

Showing 1-1 of 1 results.

A240939 Least number k >= 0 such that n! + k is a perfect power.

Original entry on oeis.org

0, 2, 2, 1, 1, 9, 1, 81, 729, 225, 324, 39169, 82944, 176400, 215296, 3444736, 26167684, 114349225, 255004929, 1158920361, 11638526761, 42128246889, 191052974116, 97216010329, 2430400258225, 1553580508516, 4666092737476, 565986718738441, 2137864362693921, 5112360635841936
Offset: 1

Views

Author

Derek Orr, Aug 03 2014

Keywords

Comments

The only n <= 805 where n! + a(n) is not a square is 3. - Robert Israel, Aug 01 2024

Crossrefs

Programs

  • Maple
    f:= proc(n) local v,m,p,r;
       m:= infinity;
       v:= n!;
       p:= 1;
       do
         p:= nextprime(p);
         if 2^p >= m+v then break fi;
         r:= ceil(v^(1/p))^p - v;
         if r < m then m:= r fi;
       od;
       m
    end proc:
    map(f, [$1..50]);
  • Mathematica
    nextPerfectPower[n_] := Min@ Table[(Floor[n^(1/k)] + 1)^k, {k, 2, 1 + Floor@ Log2@ n}]; f[n_] := nextPerfectPower[n!] - n!; f[1] = 0; Array[f, 30] (* Robert G. Wilson v, Aug 04 2014 *)
  • PARI
    a(n)=for(k=0,10^10,s=n!+k;if(ispower(s)||s==1,return(k)))
    n=1;while(n<50,print1(a(n),", ");n++)
    
  • PARI
    a(n)=for(k=1,n!,if(2^k>n!,kk=k;break));if(kk==1,return(0));L=List([]);for(i=2,kk,listinsert(L,ceil(n!^(1/i))^i-n!,1));listsort(L);L[1]
    vector(40, n, a(n)) \\ faster program

Extensions

a(18) onward from Robert G. Wilson v, Aug 04 2014
Showing 1-1 of 1 results.