OFFSET
1,1
COMMENTS
Equivalently, a(n) is the smallest k > 1 such that for all divisors d of k^n + 1, d == 1 (mod n).
A298299 is a subsequence.
All terms in this sequence are even since for odd k the expression k^n + 1 is divisible by 2 which is not congruent to 1 (mod n) for any n > 1.
If n is odd, a(n)^n + 1 is divisible by a(n) + 1. Therefore, a(n) + 1 == 1 (mod n) and so n | a(n) for odd n.
Theorem: a(n) = 2 if and only if n is a power of 2.
FORMULA
a(2n) = A298299(n).
EXAMPLE
a(3) = 6 since 6^3 + 1 = 217 = 7 * 31 and both factors are congruent to 1 (mod 3).
PROG
(PARI) isok(k, n) = my(f=factor(k^n+1)); for (i=1, #f~, if (Mod(f[i, 1], n) != 1, return(0))); return(1);
a(n) = my(k=2); while (!isok(k, n), k+=2); k; \\ Michel Marcus, Mar 22 2022
CROSSREFS
KEYWORD
nonn,hard
AUTHOR
Kevin P. Thompson, Mar 21 2022
STATUS
approved