reviewed
approved
Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
reviewed
approved
proposed
reviewed
editing
proposed
(Python)
from sympy import isprime
def a(n):
if n > 1 and n%3 == 1: return 0
k = 2
while not isprime(n**k + n + 1): k += 1
return k
print([a(n) for n in range(1, 96)]) # Michael S. Branicky, Jul 08 2021
proposed
editing
editing
proposed
Robert Israel, <a href="/A346149/b346149.txt">Table of n, a(n) for n = 1..212</a>
approved
editing
reviewed
approved
proposed
reviewed
editing
proposed
(PARI) a(n) = if ((n>1) && ((n%3)==1), 0, my(k=2); while (!isprime(n^k+n+1), k++); k); \\ Michel Marcus, Jul 07 2021
proposed
editing