%I #45 Jan 25 2019 10:37:02
%S 1,1,-1,1,-1,-1,1,1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,-1,1,-1,1,-1,1,-1,1,
%T 1,1,-1,1,-1,-1,1,1,1,1,1,1,-1,1,-1,-1,1,-1,1
%N Sign of the penultimate term of the Lucas-Lehmer sequence modulo the n-th Mersenne prime.
%C For the n-th Mersenne prime 2^p - 1 = A000668(n) (with p=A000043(n)), we have A003010(p-2) == 0 (mod 2^p - 1). Therefore A003010(p-3) == a(n) * 2^((p+1)/2) (mod 2^p - 1) where a(n) = 1 or -1.
%C From currently known Mersenne primes with exponents 57885161, 74207281, 77232917, 82589933 we have the sequence values (-1, -1, 1, -1), but there is a possibility of new Mersenne primes to be found out of order. - _Serge Batalov_, Feb 04 2013; updated by _Max Alekseyev_, Feb 25 2018, updated by _Gord Palameta_, Dec 21 2018
%H Bastiaan Jansen, <a href="http://hdl.handle.net/1887/20310">Mersenne primes and class field theory</a>. Doctoral thesis, Leiden University, 2012.
%H Mersenne Forum, <a href="http://www.mersenneforum.org/showthread.php?t=5862">Penultimate Lucas-Lehmer step</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Lucas-LehmerTest.html">Lucas-Lehmer test</a>
%F a(n) = 1 or -1 such that A003010(A000043(n)-3) = a(n) * 2^((A000043(n)+1)/2) (mod A000668(n)).
%e From _Serge Batalov_, Feb 04 2013: (Start)
%e For n=3, p=5, M_p=31, and the Lucas-Lehmer sequence is (4, 14, 8, 0). The penultimate element is 1*2^3 mod M_p = 8 mod 31, so a(3)=1.
%e For n=4, p=7, M_p=127, and the Lucas-Lehmer sequence is (4, 14, 67, 42, 111, 0). The penultimate element is -1*2^4 mod M_p = 111 mod 127, so a(4)=-1.
%e (End)
%o (PARI) test(p)=s=Mod(4, 2^p-1); for(i=1, p-3, s=s^2-2); r=2^((p+1)/2); if(s==+r,+1,s==-r,-1,"error") \\ Then a(n) = test(A000043(n)). From _Jeppe Stig Nielsen_, Jan 25 2016
%Y Cf. A000043, A000668, A003010.
%K more,sign
%O 2,1
%A _Max Alekseyev_, Oct 10 2006, Sep 29 2007
%E More terms from _Andreas Höglund_, Sep 29 2007
%E a(40) added by _Max Alekseyev_, Feb 07 2011
%E a(41)-a(46) and prospective a(47)-a(48) from _Andreas Höglund_ via _Serge Batalov_, Feb 04 2013; _Max Alekseyev_, Feb 25 2018
%E a(47) confirmed and prospective a(49)-a(51) from _Gord Palameta_, Dec 21 2018