OFFSET
1,1
COMMENTS
The Lucas-Lehmer sequence is used to test for Mersenne primes (A001348), but this is irrelevant for this sequence.
LINKS
Eric W. Weisstein's World of Mathematics, Lucas-Lehmer Test
Wikipedia, Lucas-Lehmer primality test
EXAMPLE
a(4) is 4 because p_4 = 7, and the sequence A003010 (mod 7) becomes -> 4, 0, 5, 2, 2, 2, 2, 2, 2, .... The term 2 which is the first term of an infinite loop is at position 4.
MATHEMATICA
f[n_] := -1 + Length@ NestWhileList[ Mod[#^2 - 2, Prime[n]] &, 4, UnsameQ[##] &, {2, Infinity}]; Array[f, 80]
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Robert G. Wilson v, Oct 13 2014
STATUS
approved