login
Numbers k that can be written as the sum of a perfect square and a factorial in exactly 3 distinct ways.
0

%I #13 Dec 11 2022 10:47:26

%S 145,46249,63121,42916624,18700677890064,28112213204100,

%T 41654823930457982576640000,445860623276908458083942400,

%U 666474080134036599385635225600

%N Numbers k that can be written as the sum of a perfect square and a factorial in exactly 3 distinct ways.

%C This does not count x^2 and (-x)^2 as distinct, nor does it count 0! and 1! as distinct.

%C a(10) > 10^30 if it exists. - _David A. Corneth_, Dec 11 2022

%e 145 = 5^2 + 5! = 11^2 + 4! = 12^2 + 1!.

%o (Python) import math

%o for x in range(1, 120000000):

%o total = 0

%o prod = 1

%o factInc = 2

%o while prod <= x:

%o sq = math.sqrt(x - prod)

%o if sq % 1 == 0:

%o total = total + 1

%o prod = prod * factInc

%o factInc = factInc + 1

%o if total == 3:

%o print(x)

%Y Cf. A000142, A000290.

%Y Subset of A358071.

%K nonn,hard,more

%O 1,1

%A _Walter Robinson_, Dec 11 2022

%E a(5)-a(9) from _David A. Corneth_, Dec 11 2022