login
Numbers k such that k! is the sum of a square and a triangular number.
1

%I #13 Mar 31 2026 20:29:33

%S 0,1,2,3,4,5,9,10,11,12,13,15,19,23,25,27,31,35,43,46,47,48,53,54,57,

%T 58,60,69,71,78,83

%N Numbers k such that k! is the sum of a square and a triangular number.

%F k is a term iff each prime factor congruent to 5 or 7 (mod 8) of 8*k!+1 comes in even degree.

%o (Python)

%o from math import factorial

%o from itertools import count, islice

%o from sympy.solvers.diophantine.diophantine import diop_quadratic

%o from sympy.abc import x,y

%o def A394730_gen(startvalue=0): # generator of terms >= startvalue

%o return filter(lambda k:bool(len(diop_quadratic(2*(factorial(k)-x**2)-y*(y+1)))), count(max(startvalue,0)))

%o A394730_list = list(islice(A394730_gen(),20)) # _Chai Wah Wu_, Mar 31 2026

%Y Cf. A000142, A014133, A230363.

%K nonn,more

%O 1,3

%A _Max Alekseyev_, Mar 30 2026