%I #16 Apr 14 2021 19:45:47
%S 4,14,194,37634,1416317954,669670838,1937259419,425413602,842014276,
%T 12692426,2044502122,1119438707,1190075270,1450757861,877666528,
%U 630853853,940321271,512995887,692931217,1883625615,1992425718
%N Residues of the Lucas - Lehmer primality test for M(31) = 2147483647.
%C Since a(29) = 0, M(31) = 2147483647 is prime. Mersenne numbers are only prime if a(p-2) = 0.
%H Dennis Martin, <a href="/A129226/b129226.txt">Table of n, a(n) for n = 0..29</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Lucas-LehmerTest.html">Lucas Lehmer Test</a>.
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Lucas-Lehmer_primality_test">Lucas Lehmer Primality Test</a>.
%F a(0) = 4, a(n) = a(n-1)^2 mod 2^p-1. Last term: a(p-2).
%e a(29) = 65536^2 - 2 mod 2147483647 = 0.
%o (Python)
%o p = 31; Mp = 2**p - 1
%o from itertools import accumulate
%o def f(anm1, _): return (anm1**2 - 2) % Mp
%o print(list(accumulate([4]*30, f))) # _Michael S. Branicky_, Apr 14 2021
%Y Cf. A095847, A003010, A129219, A129220, A129221, A129222, A129223, A129224, A129225, A001348.
%K fini,nonn
%O 0,1
%A _Sergio Pimentel_, Apr 04 2007