Comments on A005097 from _Richard R. Forberg_, July 2016

i^n mod (2n+1), for all integers i>0, yields only two non-zero values iff n is in this sequence. Further, those two values are 1 and 2n. 

Also note: Sum[{i, 1 to p} i^((p-1)/2) mod p] = p*(p-1)/2 = A008837, for primes p>2. Further, if i^((p-1)/2) mod p == 1, and i < p, then i is a quadratic residue of p (See Legendra Symbol in Links section). 

Conjecture: Let p be a positive prime number and q and c be any positive integers.  The two expressions p^q+c and p^q-c, are both primes for infinite set of p values, if and only if: c is not a power of a multiple of a factor of q; c/6 is an integer; and c/6 is not one of the excluded values based on union of certain two-valued, prime-based modulo cycles, which are determined based on the divisors of q. For each divisor, d, of q, (excluding 1 as a divisor, but including q itself), a prime-based modulo cycle is included in the union of excluded values iff 2d+1 is a prime (i.e., iff d is in this sequence, excluding 1). Then 2d+1 is also the prime modulo for that cycle.  For example, the lowest prime cycle is based on the prime 5, corresponding to a divisor of 2, and therefore applicable to the union of excluded of c/6 values for any even value of q.

The two excluded values in any given prime modulo cycle sum to the value of the prime for that cycle. The initial exclude values of c/6 for lowest prime cycle of 5 are {1,4} which occur for q=2. (See A047222 for q=2 and A047363 for q=3, which are both expressed as their complements).

It appears that the lower value increments (and the upper value decrements from the prime) by either 0 or 1 with each higher prime as follows: 0 if the next higher prime is the larger of a twin prime pair, and 1 if not.

The length of the joint (repeating) cycles for all q values is given by A177735.

Here are examples for different values of q based on empirical matching from searches on p^q+c and p^q-c, for excluded values for c/6. (q values up to 31 were examined, but not all are included here). The condition used during searching to test for an "infinite set of p values" was a count greater than one, because occasionally a single p value (e.g., p=3) allows both p^q+c and p^q-c to be prime for a given c/6. When more than one modulo cycle appears on a line that implies the union of all of them; the length of the (joint) repeating pattern of excluded c/6 values grows accordingly. E.g. q=6 has a joint cycle of 5*7*13=455, and q=18 has a joint cycle of 5*7*13*19*37 = 319865.

q=1: (none are excluded)
q=2:  {1,4} mod 5
q=3:  {1,6} mod 7
q=4:  {1,4} mod 5
q=5:  {2,9} mod 11
q=6:  {1,4} mod 5; {1,6} mod 7; {2,11} mod 13
q=7:(none are excluded)
q=8:  {1,4} mod 5; {3,14} mod 17
q=9:  {1,6} mod 7; {3,16} mod 19
q=10: {1,4} mod 5; {2,9} mod 11
q=11: {4,19} mod 23
q=12: {1,4} mod 5; {1,6} mod 7; {2,11} mod 13
q=13:(none are excluded)
q=14: {1,4} mod 5; {5,24} mod 29
q=15: {1,6} mod 7; {2,9} mod 11; {5,26} mod 31
q=16: {1,4} mod 5; {3,14} mod 17
q=17:(none are excluded)
q=18: {1,4} mod 5; {1,6} mod 7; {2,11} mod 13; {3,16} mod 19; {6,31} mod 37 
q=19:(none are excluded)
q=20: {1,4} mod 5; {2,9} mod 11; {7,34} mod 41

Note: There will appear occasionally additional excluded values of the form (6*c)^n/6, n>1, due to polynomial factorization.