This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A317977 #24 Oct 09 2018 09:53:16 %S A317977 1,0,14,0,23,0,149,205,95,1736,779,0,4193,20400,25439,0,221468,0, %T A317977 1036394,840107,1751891,6107895,5639594,8772568,66322529,60611448, %U A317977 99083624,458738443,989927528,0,3038229779,5238898821,393215,11960838285,27264928469,117093979072,274827575393,276971366821 %N A317977 a(n) = A003010(n-2) mod (2^n - 1). %C A317977 For n > 2, the Mersenne number 2^n - 1 is a prime if and only if a(n) = 0. See comments in A003010. %H A317977 Chai Wah Wu, <a href="/A317977/b317977.txt">Table of n, a(n) for n = 2..3322</a> %F A317977 a(prime(n)) = A095847(n). %o A317977 (PARI) a(n) = {my(pow = 2^n-1, res = Mod(4, pow)); for(i = 1, n-2, res = res^2 - 2); lift(res)} %o A317977 first(n) = vector(n, i, a(i+1)) \\ _David A. Corneth_, Aug 12 2018 %o A317977 (Python) %o A317977 def A317977(n): %o A317977 m = 2**n-1 %o A317977 c = 4 % m %o A317977 for _ in range(n-2): %o A317977 c = (c**2-2) % m %o A317977 return c # _Chai Wah Wu_, Oct 08 2018 %Y A317977 Cf. A000043, A000225, A000668, A003010, A095847. %K A317977 nonn %O A317977 2,3 %A A317977 _Thomas Ordowski_, Aug 12 2018 %E A317977 More terms from _Michel Marcus_ and _David A. Corneth_, Aug 12 2018