OFFSET

1,1

COMMENTS

The only known values of n such that n!+1 is a perfect square are 4, 5 and 7. Paul Leyland, et al. have found no other solutions for n <= 1 million (see link). For 1 <= n <= 11, n!+1 is within 1000 of being a square. Is there another n such that n!+1 <= "1000 away" from being a perfect square?

LINKS

Amiram Eldar, Table of n, a(n) for n = 1..808

P. Leyland, Solutions to n!+1=m^2.

EXAMPLE

a(5)=0 because 5!+1 is a square.

a(8)=80 because 8!+1 = 40321 and the next larger square is 40401, so 40401-40321 = 80.

MATHEMATICA

a[n_] := Ceiling @ Sqrt[(f = n! + 1)]^2 - f; Array[a, 27] (* Amiram Eldar, Dec 14 2019 *)

PROG

(PARI) for(k=1, 27, print1(ceil(sqrt(k!+1))^2-(k!+1), ", ")) \\ Hugo Pfoertner, Dec 14 2019

CROSSREFS

KEYWORD

nonn

AUTHOR

Jason Earls, May 29 2003

STATUS

approved