%I #36 Oct 02 2024 14:21:32
%S 2,3,4,5,6,7,8,12,15,58,59,102,111,118,164,291,589,685,1671,1900,1945,
%T 4905,9564
%N Numbers k such that k! - Sum_{i=1..k-1} (-1)^(k-i)*i! is prime.
%C Numbers k such that k! + A005165(k - 1) is prime.
%C a(23) > 7000. - _Hugo Pfoertner_, Mar 15 2023
%e 2 is in the sequence because 2! + 1! = 3.
%e 3 is in the sequence because 3! + (2! - 1!) = 7.
%e 4 is in the sequence because 4! + (3! - 2! + 1!) = 29.
%e 5 is in the sequence because 5! + (4! - 3! + 2! - 1!) = 139.
%o (PARI) isok(k) = isprime(k! + sum(i=1, k-1, (-1)^(i+1)*(k-i)!)); \\ _Michel Marcus_, Mar 12 2023
%Y Cf. A361436 (the corresponding primes).
%Y Cf. A001272, A005165 (alternating factorials), A071828.
%K nonn,hard,more
%O 1,1
%A _Jack Braxton_, Mar 11 2023
%E Missing a(10) inserted and a(12)-a(18) from _Andrew Howroyd_, Mar 12 2023
%E a(19)-a(22) from _Hugo Pfoertner_, Mar 13 2023
%E a(23) from _Michael S. Branicky_, Oct 02 2024