Golf the Lucas Lehmer Primality Test your task is to write a program that uses the Lucas-Lehmer primality test to check whether an input number is prime or not. This prime number candidate has the form 2p-1 with p being prime. (Mersenne prime number)

The Lucas-Lehmer-test

The n-th Mersenne number is prime if it is a divisor of the (n-1)-th Lucas-Lehmer number (LLN).
You can calculate the LLN, similiar to the Fibonacci numbers, based on a recursive algorithm:

L&lt;n&gt; = (L&lt;n-1&gt;)^2 - 2


The LLN for 2 is 14. So, for p=3, LLN&lt;3-1>=14

Evaluation


You have to submit a function that takes p as input (Remember: 2^p-1)
The shortest solution will win.
Your solution has to use the Lucas-Lehmer test
The code must be executable.
Output: boolean value or 1=prime/0=not prime


Tests:

p --&gt; 2^p-1  --&gt; LLN&lt;n-1&gt; --&gt; ?
3 --&gt; 7      --&gt; 14  --&gt; prime
5 --&gt; 31     --&gt; 37634 &gt; prime (1214*31)


Good Luck
Python 2, 51 bytes



p=input()
s=4
exec's=(s*s-2)%(2**p-1);'*(p-2)
s&gt;0&gt;x


Try it online!

Output is via exit code