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.

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

This page as a plain text file.
%I A260374 #13 May 22 2025 10:21:43
%S A260374 0,0,1,2,1,1,9,1,81,476,225,324,4604,74879,176400,215296,3444736,
%T A260374 11551671,45680444,255004929,1158920361,2657058876,24923993276,
%U A260374 130518272975,97216010329,2430400258225,1553580508516,4666092737476,538347188396016,2137864362693921
%N A260374 The distance between n! and the nearest perfect square.
%F A260374 a(n) = abs(n!-A260373(n)).
%e A260374 6!=720. The nearest perfect square is 729. The difference between these is 9, so a(6)=9.
%o A260374 (PARI) a(n)=abs(n!-round(sqrt(n!))^2) \\ _Charles R Greathouse IV_, Jul 23 2015
%o A260374 (Python)
%o A260374 from gmpy2 import isqrt
%o A260374 A260374_list, g = [0], 1
%o A260374 for i in range(1, 1001):
%o A260374     g *= i
%o A260374     s = isqrt(g)
%o A260374     t = g-s**2
%o A260374     A260374_list.append(int(t if t-s <= 0 else 2*s+1-t)) # _Chai Wah Wu_, Jul 23 2015
%Y A260374 Cf. A260373, A260375.
%K A260374 nonn
%O A260374 0,4
%A A260374 _Otis Tweneboah_, _Pratik Koirala_, _Eugene Fiorini_, _Nathan Fox_, Jul 23 2015