OFFSET
1,1
COMMENTS
Equivalently, least k such that the product of the first n positive integers is less than the sum of the integers from n+1 through k.
a(n) = floor(sqrt(2*n! + n^2)) for most values of n; the exceptions are 1,2,3,7,..., in which case a(n) = floor(sqrt(2*n! + n^2)) + 1.
FORMULA
Least k such that {k(k+1)/2 - n(n+1)/2} >= n!.
a(n) = ceiling((-1 + sqrt(1 + 8n! + 4n^2 + 4n))/2) and ignoring the -1 outside the sqrt and the 1 inside gives the approximate formula in the comment. - Joshua Zucker, May 08 2006
EXAMPLE
a(4) = 8 because 4! = 24 and 5+6+7+8 = 26 > 24, but 5+6+7 = 18.
a(5) = 16 because 5! = 120 and 6+7+8+...+15+16 = 121 > 120.
PROG
(PARI) { for(n=1, 20, s=0; found=0; for(k=n+1, 10000000, if( k*(k+1)-n*(n+1)>= 2*n!, print1(k, ", "); found=1; break; ); ); if(found==0, print(0); ); ); } \\ R. J. Mathar, Apr 21 2006
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Amarnath Murthy, Mar 29 2004
EXTENSIONS
More terms from R. J. Mathar, Apr 21 2006
More terms from Joshua Zucker, May 08 2006
Name simplified by Jon E. Schoenfield, Jun 15 2019
STATUS
approved