login
Sums of distinct factorials that are of the form x^2 - 1.
0

%I #21 Jun 26 2023 08:46:43

%S 0,3,8,24,120,728,840,5040,45368,46224,363608,403224,3674888,

%T 1401602635448

%N Sums of distinct factorials that are of the form x^2 - 1.

%C 0! and 1! are not considered to be distinct.

%C a(15) > 40! if it exists. - _Bert Dobbelaere_, Jun 13 2023

%C From _Jon E. Schoenfield_, Jun 03 2023: (Start)

%C There exist only 9 residues (x^2 - 1) mod 7! that are sums of distinct factorials:

%C 0 (the empty sum)

%C 3 = 2! + 1!

%C 8 = 3! + 2!

%C 24 = 4!

%C 120 = 5!

%C 720 = 6!

%C 728 = 6! + 3! + 2!

%C 840 = 6! + 5!

%C 864 = 6! + 5! + 4!

%C Thus, if an exhaustive search were to be performed for terms having any given set of factorial indices >= 7 (e.g., a search for terms of the form 10! + 8! + 7! + ..., where the ellipsis represents a sum of 0 or more distinct factorials from {1!, 2!, 3!, 4!, 5!, 6!}), rather than testing all 2^6 = 64 subset sums of those 6 smallest factorials, only the 9 residues listed above would need to be considered. E.g., for 10! + 8! + 7! = 3674160, only the 9 sums s = 3674160 + {0, 3, 8, ..., 864} would need to be checked to see whether s+1 is a square (x^2).

%C However, since 1916 < sqrt(3674160) < 1917, and 1918^2 > s + 864, the only possible solution is at x = 1917, which gives 1917^2 - 1 = 3674888 = 3674160 + 728, and 728 is one of the 9 possible residues mod 7!, so 3674888 is a term.

%C (End)

%H Mathematics StackExchange, <a href="https://math.stackexchange.com/questions/4709479/why-does-a-sum-of-factorials-behave-differently-from-single-factorials/4709512#4709512">Why does a sum of factorials behave differently from single factorials?</a>

%e a(6) = 728 is a term because 728 = 2! + 3! + 6! = 27^2 - 1.

%p filter:= proc(n) local m,x,i;

%p x:= n;

%p for m from 1 while m! < n do od:

%p for i from m to 1 by -1 do

%p if x >= i! then

%p x:= x - i!;

%p if x = 0 then return true fi;

%p fi

%p od;

%p false

%p end proc:

%p filter(0):= true:

%p select(filter, [seq(i^2-1,i=1..10^7)]);

%Y Intersection of A005563 and A059590. Cf. A014597.

%K nonn,more

%O 1,2

%A _Robert Israel_, May 30 2023