login
A240940
Least number k >= 0 such that n! - k is a perfect power.
0
0, 1, 2, 8, 20, 44, 127, 320, 476, 3584, 12311, 4604, 74879, 414119, 2071775, 5703551, 11551671, 45680444, 442548224, 1960632176, 2657058876, 24923993276, 130518272975, 1478154932316, 5446454455004, 38610655379975, 204033398880671, 538347188396016, 3809155729331900, 27460809907547975, 52607402757814775
OFFSET
1,3
PROG
(PARI)
a(n)=for(k=0, n!, 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, n!-floor(n!^(1/i))^i, 1)); listsort(L); L[1]
vector(40, n, a(n)) \\ faster program
CROSSREFS
Cf. A066857 (n! - k is a square), A226973.
Sequence in context: A165751 A296954 A203604 * A066857 A146168 A058405
KEYWORD
nonn
AUTHOR
Derek Orr, Aug 04 2014
STATUS
approved