OFFSET
1,1
COMMENTS
a(n) = smallest k > 2^n such that k == 1 (mod n) and 2^(k-1) == 1 (mod k), so a(n) is an odd prime or a pseudoprime (Fermat pseudoprime to base 2).
Conjecture: a(n) is composite if and only if n = 2^j and 2^(2^j) + 1 is composite (presumably for all j > 4).
Note that a(2^j) = 2^(2^j) + 1 = A000215(j), the Fermat numbers.
For n <> 2^j, a(n) is the smallest k = 2^n - (2^n mod n) + m*n + 1 for m > 0 such that 2^(k-1) == 1 (mod k).
The last definition, also without the condition n <> 2^j, probably gives only primes.
FORMULA
a(n) == 1 (mod n).
a(2^j) = A000215(j).
EXAMPLE
a(32) = 2^(2^5) + 1 = 641*6700417 is the smallest composite term.
MATHEMATICA
a[n_] := Module[{k = 2^n + 1}, While[PowerMod[2, k - 1, (2^n - 1)*k] != 1, k++]; k]; Array[a, 50] (* Amiram Eldar, Apr 12 2019 *)
PROG
(PARI) a(n) = my(k=2^n+1); while( Mod(2, (2^n-1)*k)^(k-1) != 1, k++); k; \\ Michel Marcus, Apr 25 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Thomas Ordowski, Apr 12 2019
EXTENSIONS
More terms from Amiram Eldar, Apr 12 2019
STATUS
approved