A248755 a(n) is the number of iterations for the Lucas-Lehmer sequence A003010 (mod p_n) to enter a loop, where p_n is the n-th prime number A000040(n).
2, 2, 1, 4, 3, 3, 4, 2, 5, 4, 6, 5, 4, 5, 11, 3, 15, 6, 5, 3, 5, 6, 11, 13, 5, 4, 9, 27, 11, 10, 8, 7, 23, 13, 20, 12, 14, 10, 41, 28, 12, 4, 36, 4, 15, 13, 27, 8, 15, 11, 13, 24, 5, 51, 8, 65, 36, 8, 13, 47, 36, 42, 31, 20, 13, 52, 42, 6, 87, 16, 30, 89, 15, 7, 36, 95, 6, 17, 34, 10
Offset: 1
Examples
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.
Links
- GIMPS, Great Internet Mersenne Prime Search
- Eric W. Weisstein's World of Mathematics, Lucas-Lehmer Test
- Wikipedia, Lucas-Lehmer primality test
Programs
-
Mathematica
f[n_] := -1 + Length@ NestWhileList[ Mod[#^2 - 2, Prime[n]] &, 4, UnsameQ[##] &, {2, Infinity}]; Array[f, 80]
Comments