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-2 of 2 results.

A093000 Least k such that Sum_{r=n+1..k} r >= n!.

Original entry on oeis.org

2, 3, 5, 8, 16, 38, 101, 284, 852, 2694, 8935, 30952, 111598, 417560, 1617204, 6468816, 26671611, 113158064, 493244565, 2205856753, 10108505545, 47413093714, 227385209453, 1113955476429, 5569777382146, 28400403557929
Offset: 1

Views

Author

Amarnath Murthy, Mar 29 2004

Keywords

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.

Examples

			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.
		

Crossrefs

Cf. A093001.

Programs

  • 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

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

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

A355182 a(n) = t(n) - s(n) where s(n) = n*(n-1)/2 is the sum of the first n nonnegative integers and t(n) is the smallest sum of consecutive integers starting from n such that t(n) > s(n).

Original entry on oeis.org

1, 1, 4, 3, 1, 6, 3, 10, 6, 1, 10, 4, 15, 8, 21, 13, 4, 19, 9, 26, 15, 3, 22, 9, 30, 16, 1, 24, 8, 33, 16, 43, 25, 6, 35, 15, 46, 25, 3, 36, 13, 48, 24, 61, 36, 10, 49, 22, 63, 35, 6, 49, 19, 64, 33, 1, 48, 15, 64, 30, 81, 46, 10, 63, 26, 81, 43, 4, 61, 21, 80, 39, 100, 58, 15, 78, 34, 99
Offset: 1

Views

Author

Andrea La Rosa, Jun 23 2022

Keywords

Comments

Record high values of a(n)/n approach sqrt(2) and occur at values of n that are terms of A011900; a(A011900(k)) = A046090(k). - Jon E. Schoenfield, Jun 23 2022
It appears that the sequence 1,2,4,5,6,8,... (the largest integer in the t(n) sum) is A288998. - Michel Marcus, Jun 24 2022

Examples

			a(6) = -s(6) + t(6):
s(6) is the sum of the first 6 nonnegative integers = 6*5 / 2 = 15.
t(6) is the smallest sum k of consecutive integers starting from n = 6 such that k > s(6) = 15.
The first few sets of consecutive integers starting from 6 are
  {6}, whose elements add up to 6,
  {6, 7}, whose elements add up to 13,
  {6, 7, 8}, whose elements add up to 21,
  {6, 7, 8, 9}, whose elements add up to 30,
  ...
the smallest sum that is > 15 is 21, so t(6) = 21, so a(6) = -15 + 21 = 6.
		

Crossrefs

Programs

  • JavaScript
    function a(n) {
        var sum = 0;
        for (var i = 0; i < n; i++)
            sum -= i;
        while (sum <= 0)
            sum += i++;
        return sum;
    }
    
  • PARI
    a(n) = my(t=0, s=n*(n-1)/2, k=n); until (t > s, t += k; k ++); t-s; \\ Michel Marcus, Jun 24 2022
    
  • Python
    from math import isqrt
    def A355182(n): return ((m:=(isqrt(((k:=n*(n-1))<<3)+1)+1)>>1)*(m+1)>>1)-k # Chai Wah Wu, Jul 14 2022

Formula

From Jon E. Schoenfield, Jun 23 2022: (Start)
a(n) = t(n) - s(n) where
s(n) = n*(n-1)/2,
j = floor(sqrt(8*n^2 - 8*n + 1)),
m = ceiling(j/2) - n + 1, and
t(n) = (m*(m + 2*n - 1))/2. (End)
Showing 1-2 of 2 results.