OFFSET
1,1
COMMENTS
The PARI code uses a function that assumes 0 has a digital root of 9.
Note: since I allowed 0 to count as having digital root 9, all Mersenne prime exponents > 2 will be a subsequence of this sequence.
MATHEMATICA
lucaslehmer2Q[p_] := Module[{s = 4, x}, For[x = 1, x <= p-2, x++, s = Mod[s^2 - 2, 2^p - 1]; If[x == p-2 && sumdigits1[s] == 9, Return[True]]]; False];
sumdigits1[n_] := If[Mod[n, 9] != 0, Mod[n, 9], 9];
Select[Range[1000], lucaslehmer2Q] (* Jean-François Alcover, Sep 28 2020, after PARI *)
PROG
(PARI) lucaslehmer2(p) = s=4; for(x=1, p-2, s=(s^2-2)%(2^p-1)); if(x=p-2 && sumdigits1(s)==9, print1(p", "))
sumdigits1(n)=if(n%9!=0, n%9, 9)
for(x=1, 1000, lucaslehmer2(x))
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Roderick MacPhee, Nov 26 2010
STATUS
approved