login
Primes of the form Sum_{i=1..k} (-1)^(k-i)*i!.
9

%I #29 Oct 02 2024 01:55:41

%S 5,19,101,619,4421,35899,3301819,1226280710981,115578717622022981,

%T 32656499591185747972776747396512425885838364422981

%N Primes of the form Sum_{i=1..k} (-1)^(k-i)*i!.

%D R. K. Guy, Unsolved Problems in Number Theory, Springer, 1st edition, 1981. See section B43.

%H Charles R Greathouse IV, <a href="/A071828/b071828.txt">Table of n, a(n) for n = 1..14</a>

%H M. Zivkovic, <a href="https://doi.org/10.1090/S0025-5718-99-00990-4">The number of primes sum_(i=1..n)(-1)^(n-i)i! is finite</a>, Math. Comp., vol. 68 (1999), pp. 403-409.

%F a(n) = A005165(A001272(n)).

%t l = Abs@Accumulate[(-1)^#*#! & /@ Range@99]; l[[Flatten@Position[l, _?PrimeQ]]] (* _Hans Rudolf Widmer_, Feb 27 2023 *)

%o (PARI) for(n=1,120,if(isprime(abs(sum(i=1,n,(-1)^i*i!)))==1,print1(abs(sum(i=1,n,(-1)^i*i!)),",")))

%o (PARI) v=[];for(n=1,1000, if(ispseudoprime(t=abs(sum(i=1,n,(-1)^i*i!))), v=concat(v,t))); v \\ _Charles R Greathouse IV_, Feb 14 2011

%Y Cf. A001272, A005165.

%K nonn,fini

%O 1,1

%A _Benoit Cloitre_, Jun 08 2002

%E Edited by _R. J. Mathar_, Aug 28 2007