OFFSET
0,4
FORMULA
a(n) can be = 2 only if n = 6*m + 3 for m >= 0 and m is not congruent to {0, 4} mod 5, not congruent to {2, 4} mod 7, not congruent to {6, 7} mod 11 and not congruent to {3, 9} mod 13. Does a(n) = 2 for n > 9 exist? - Thomas Scheuerle, Jan 12 2023
EXAMPLE
f(-1,1) = 2^1 - 1 = 1, is not prime and f(1,1) = 2^1 + 1 = 3 is prime, so a(1) = 1.
f(-1,2) = 2^2 - 2 = 2, is prime and f(1,2) = 2^2 + 2 = 6 = 2 * 3 is not prime, so a(2) = -1.
f(-1,3) = 2^3 - 3 = 5, is prime and f(1,3) = 2^3 + 3 = 11 is prime, so a(3) = 2.
PROG
(PARI) f(s, n)=2^n+s*n
a(n)=my(a=isprime(f(-1, n)), b=isprime(f(1, n)), c=a+b); if(c==1&&a==1, return(-1), return(c))
CROSSREFS
KEYWORD
sign
AUTHOR
Jean-Marc Rebert, Jan 12 2023
STATUS
approved