OFFSET
1,2
COMMENTS
From Chris Boyd, Mar 16 2014: (Start)
n is a term if and only if n=0, 2n+1 is a prime of the form 8k+-1, or 2n+1 is an Euler pseudoprime satisfying 2^n == 1 mod 2n+1.
Case 1: 0 is a term. Case 2, 2n+1 prime: by Euler's criterion and the quadratic character of 2, 2^n == 1 mod 2n+1 only if 2n+1 is of the form 8k+-1. Case 3, 2n+1 composite: 2^n == 1 mod 2n+1 only if 2n+1 is one of the subset of Euler pseudoprimes satisfying 2^n == 1 mod 2n+1.
The first term for which 2n+1 is a qualifying Euler pseudoprime is n=170.
The first Euler pseudoprime that does not correspond to a term is 3277, because 2^((3277-1)/2) == -1 mod 3277. (End)
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
FORMULA
k such that A002326(k)|k: since 2^k == 1 mod 2*k+1, k must be a multiple of the order of 2 mod 2*k+1.
MATHEMATICA
Join[{0}, Select[Range[300], PowerMod[2, #, 2*# + 1] === 1 &]] (* Amiram Eldar, Jun 02 2022 *)
PROG
(PARI) isok(n) = !((2^n-1) % (2*n+1)); \\ Michel Marcus, Dec 04 2013
(PARI) for(n=0, 400, if(n%znorder(Mod(2, 2*n+1))==0, print1(n", "))) \\ Chris Boyd, Mar 16 2014, after Michael Somos in A002326
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Apr 11 2003
EXTENSIONS
Formula corrected by Chris Boyd, Mar 16 2014
STATUS
approved