login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A240939 Least number k >= 0 such that n! + k is a perfect power. 0

%I #22 Aug 08 2014 14:47:25

%S 0,2,2,1,1,9,1,81,729,225,324,39169,82944,176400,215296,3444736,

%T 26167684,114349225,255004929,1158920361,11638526761,42128246889,

%U 191052974116,97216010329,2430400258225,1553580508516,4666092737476,565986718738441,2137864362693921,5112360635841936

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

%t 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 *)

%o (PARI)

%o a(n)=for(k=0,10^10,s=n!+k;if(ispower(s)||s==1,return(k)))

%o n=1;while(n<50,print1(a(n),", ");n++)

%o (PARI)

%o 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]

%o vector(40, n, a(n)) \\ faster program

%Y Cf. A068869, A240937.

%K nonn

%O 1,2

%A _Derek Orr_, Aug 03 2014

%E a(18) onward from _Robert G. Wilson v_, Aug 04 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 18 11:29 EDT 2024. Contains 371779 sequences. (Running on oeis4.)