OFFSET
1,1
COMMENTS
The asymptotic density of this sequence is 1/8 (Deshouillers and Luca, 2010). - Amiram Eldar, Jan 11 2021
LINKS
Hugo Pfoertner, Table of n, a(n) for n = 1..5000
Dario Alpern, Sum of squares web application.
Rob Burns, Factorials and Legendre's three-square theorem, arXiv:2101.01567 [math.NT], 2021.
Jean-Marc Deshouillers and Florian Luca, How often is n! a sum of three squares?, in: The legacy of Alladi Ramakrishnan in the mathematical sciences, Springer, New York, 2010, pp. 243-251.
FORMULA
Equivalently, k! is of the form (4^i)*(8*j+7), i >= 0, j >= 0.
EXAMPLE
a(1) = 10 because 10! cannot be written as the sum of fewer than 4 squares.
MATHEMATICA
Select[Range[500], Mod[#!/4^IntegerExponent[#!, 4], 8] == 7 &] (* Amiram Eldar, Jan 11 2021 *)
PROG
See link.
(PARI) isA004215(n)= n\4^valuation(n, 4)%8==7;
isok(n) = isA004215(n!); \\ Michel Marcus, Dec 30 2020
(Python 3.10+)
from math import factorial
from itertools import count, islice
def A084953_gen(startvalue=1): # generator of terms >= startvalue
return filter(lambda n:(factorial(n)>>((n-n.bit_count())&-2))&7==7, count(max(startvalue, 1)))
CROSSREFS
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, Jun 15 2003
EXTENSIONS
Edited and extended by Robert G. Wilson v, Jun 17 2003
Added missing term 357 by Rob Burns, Dec 30 2020
STATUS
approved