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

A055227 Nearest integer to sqrt( n! ).

Original entry on oeis.org

1, 1, 1, 2, 5, 11, 27, 71, 201, 602, 1905, 6318, 21886, 78911, 295260, 1143536, 4574144, 18859677, 80014834, 348776577, 1559776269, 7147792818, 33526120082, 160785623545, 787685471323, 3938427356615, 20082117944246, 104349745809074, 552166953567228
Offset: 0

Views

Author

Henry Bottomley, Jun 21 2000

Keywords

Crossrefs

Programs

  • Mathematica
    Round[Sqrt[Range[0,30]!]] (* Harvey P. Dale, Aug 27 2013 *)
  • Python
    from gmpy2 import isqrt
    A055227_list, g = [1], 1
    for i in range(1, 101):
        g *= i
        s = isqrt(g)
        A055227_list.append(int(s if g-s*(s+1) <= 0 else s+1))  # Chai Wah Wu, Jul 24 2015

Formula

a(n) = A000194(A000142(n)).

A260374 The distance between n! and the nearest perfect square.

Original entry on oeis.org

0, 0, 1, 2, 1, 1, 9, 1, 81, 476, 225, 324, 4604, 74879, 176400, 215296, 3444736, 11551671, 45680444, 255004929, 1158920361, 2657058876, 24923993276, 130518272975, 97216010329, 2430400258225, 1553580508516, 4666092737476, 538347188396016, 2137864362693921
Offset: 0

Views

Author

Keywords

Examples

			6!=720. The nearest perfect square is 729. The difference between these is 9, so a(6)=9.
		

Crossrefs

Programs

  • PARI
    a(n)=abs(n!-round(sqrt(n!))^2) \\ Charles R Greathouse IV, Jul 23 2015
    
  • Python
    from gmpy2 import isqrt
    A260374_list, g = [0], 1
    for i in range(1, 1001):
        g *= i
        s = isqrt(g)
        t = g-s**2
        A260374_list.append(int(t if t-s <= 0 else 2*s+1-t)) # Chai Wah Wu, Jul 23 2015

Formula

a(n) = abs(n!-A260373(n)).

A260375 Numbers k such that A260374(k) is a perfect square.

Original entry on oeis.org

0, 1, 2, 4, 5, 6, 7, 8, 10, 11, 14, 15, 16
Offset: 1

Views

Author

Keywords

Comments

There are a surprising number of small terms in this sequence.
Heuristic: The square root of x has an average distance of 1/4 to an integer, so |x - round(sqrt(x))^2| is around |x - (sqrt(x) - 1/4)^2| or about sqrt(x)/2, hence A260374(n) is around sqrt(n!)/2. By Stirling's approximation this is around (n/e)^(n/2) which is a square with probability (n/e)^(-n/4). The integral of this function converges, so this sequence should be finite. This heuristic is crude, though, because it does not model the extreme values of A260374. - Charles R Greathouse IV, Jul 23 2015
There are no further terms up to 10^5, so probably the list is complete. - Charles R Greathouse IV, Jul 23 2015

Examples

			6! = 720. The nearest perfect square is 729. The difference is 9, which is itself a perfect square. So, 6 is in this sequence.
		

Crossrefs

Programs

  • PARI
    is(n)=my(N=n!,s=sqrtint(N)); issquare(min(N-s^2, (s+1)^2-N)) \\ Charles R Greathouse IV, Jul 23 2015
    
  • Python
    from gmpy2 import isqrt, is_square
    A260375_list, g = [0], 1
    for i in range(1, 1001):
        g *= i
        s = isqrt(g)
        t = g-s**2
        if is_square(t if t-s <= 0 else 2*s+1-t):
            A260375_list.append(i) # Chai Wah Wu, Jul 23 2015
Showing 1-3 of 3 results.