login
Primes p such that p divides 0!-1!+2!-3!+...+(-1)^{p-1}(p-1)!.
8

%I #37 Oct 29 2023 10:50:34

%S 2,5,13,37,463

%N Primes p such that p divides 0!-1!+2!-3!+...+(-1)^{p-1}(p-1)!.

%C If p is in the sequence then p divides 0!-1!+2!-3!+...+(-1)^N N! for all sufficiently large N. Naive heuristics suggest that the sequence should be infinite but very sparse.

%C Same as the terms > 1 in A124779. - _Jonathan Sondow_, Nov 09 2006

%C A prime p is in the sequence if and only if p|A(p-1), where A(0) = 1 and A(n) = n*A(n-1)+1 = A000522(n). - _Jonathan Sondow_, Dec 22 2006

%C Also, a prime p is in this sequence if and only if p divides A061354(p-1). - _Alexander Adamchuk_, Jun 14 2007

%C Michael Mossinghoff has calculated that 2, 5, 13, 37, 463 are the only terms up to 150 million. - _Jonathan Sondow_, Jun 12 2007

%D R. K. Guy, Unsolved Problems in Theory of Numbers, Springer-Verlag, Third Edition, 2004, B43.

%H Jonathan Sondow, <a href="https://web.archive.org/web/20200215083228/https://home.earthlink.net/~jsondow/PrimesAndE.pdf">The Taylor series for e and the primes 2, 5, 13, 37, 463: a surprising connection</a>

%H Jonathan Sondow and K. Schalm, <a href="http://arxiv.org/abs/0709.0671">Which partial sums of the Taylor series for e are convergents to e? (and a link to the primes 2, 5, 13, 37, 463), II</a>, arXiv:0709.0671 [math.NT], 2007-2009.

%H <a href="/index/Fa#factorial">Index entries for sequences related to factorial numbers</a>

%e 5 is in the sequence because 5 is prime and it divides 0!-1!+2!-3!+4!=20.

%t Select[Select[Range[500], PrimeQ], (Mod[Sum[(-1)^(p - 1)*p!, {p, 2, # - 1}], #] == 0) &] (* _Julien Kluge_, Feb 13 2016 *)

%t a[0] = 1; a[n_] := a[n] = n*a[n - 1] + 1; Select[Select[Range[500], PrimeQ], (Mod[a[# - 1], #] == 0) &] (* _Julien Kluge_, Feb 13 2016 with the sequence approach suggested by _Jonathan Sondow_ *)

%t Select[Prime[Range[500]],Divisible[AlternatingFactorial[#]-1,#]&] (* _Harvey P. Dale_, Jan 08 2021 *)

%o (PARI) A=1;for(n=1,1000,if(isprime(n),if(Mod(A,n)==0,print(n)));A=n*A+1) \\ _Jonathan Sondow_, Dec 22 2006

%Y Cf. A064383, A124779, A000522, A061354, A129924.

%K nonn,nice,hard,more

%O 1,1

%A Kevin Buzzard (buzzard(AT)ic.ac.uk), Sep 28 2001

%E Edited by _Max Alekseyev_, Mar 05 2011