PRESS SPACE Enter a PRIME number (if the exponent isn't prime, the result won't be either). This test checks to see if 2^p-1 where p is the number you entered and is greater than 2. Press space again if you want to test another number. If you find anything wrong please tell me. Also it doesn't work with numbers that are too large (this is Scratch after all).
Big thanks to Édouard Lucas for devising the test and Derrick Henry Lehmer for proving it. They did all the actual work. I just coded it up in Scratch. This project runs a Lucas-Lehmer Test. What it does is: var s = 4 var M = 2^p − 1 repeat p − 2 times: s = ((s × s) − 2) mod M if s == 0 return PRIME else return COMPOSITE