login
Numbers n such that -1 + Sum_{k=1..n} prime(k)! is prime, where prime(k) is the k-th prime.
0

%I #41 May 03 2021 12:16:33

%S 2,3,4,20,25

%N Numbers n such that -1 + Sum_{k=1..n} prime(k)! is prime, where prime(k) is the k-th prime.

%C The sequence is finite. Proof: for n=112, the sum is 2! + 3! + 5! + ... + 601! + 607! - 1, which is divisible by the next prime, 613. All the factorials of the subsequent primes 613!, 617!, ... are obviously divisible by 613. So after n=112 the sum will always be divisible by 613. And from n=26 to n=112 there are no other primes. So this sequence will not produce any other primes. - _Metin Sariyar_, Aug 26 2019

%e 4 is a term because 2, 3, 5, 7 are the first 4 primes and 2! + 3! + 5! + 7! - 1 = 5167 is prime.

%t p=-1; lst={}; Do[p+=Prime[n]!; If[PrimeQ[p], AppendTo[lst, n]], {n, 1000}]; lst

%t Position[Accumulate[Prime[Range[25]]!],_?(PrimeQ[#-1]&)]//Flatten (* _Harvey P. Dale_, May 03 2021 *)

%o (PARI) isok(n) = isprime(sum(k=1, n, prime(k)!) - 1); \\ _Michel Marcus_, Aug 18 2019

%Y Cf. A000040, A000142, A002982, A111179, A039716.

%K nonn,fini,full

%O 1,1

%A _Metin Sariyar_, Aug 17 2019