I am looking at the sequence A002822 which essentially is equivalent to the twin prime sequence. Based on initial investigations, it has the following peculiar congruential structure.
Pattern A
For each prime $p\geq 5$, there exists a residue $a_p$ with $0\leq a_p <p$ such that if $n \bmod p = \pm a_p$ then $n$ does not belong to the sequence, except possibly if $n=a_p$. Otherwise, $n$ belongs to the sequence. The values of $a_p$, respectively for $p = 5, 7, 11, 13, 17, 19, 23, 29, 31$, are $a_p = 1, 1, 2, 2, 3, 3, 4, 5, 5$.
Pattern B
Besides these congruential exceptions, all values in A002822 are equidistributed modulo $p$, regardless of $p$.
Question: the original question was: can you prove pattern A? It has been positively answered, see the answer below.
Update: pattern C and new question
I found a new pattern and I am wondering if I should create a separate question about it. I am very interested in the answer.
Pattern C is simply the fact that $a_p=\lfloor \frac{p}{6}+\frac{1}{2}\rfloor$ (assuming $p\geq 5$ is prime). At this point, this is just an empirical observation, verified up to $p=181$.
Motivation
Assuming patterns A and B are correct, we then get the following, unless I am wrong. Let $f(x)$ be the number of elements less than or equal to $x$ in the sequence in question. Then
$$f(x)\sim x\cdot \prod_{5\leq p \leq x}\frac{p-2}{p}\sim C\cdot\frac{x}{(\log x)^2} \mbox{ as } x\rightarrow\infty.$$
Note that we ignored the fact that some of the elements of the sequence are unaccounted for in the above formula: these are the elements for which $a_p$ is itself part of the sequence. Not a big deal, since the interest is to prove that the sequence has infinitely many elements (that is, there are infinitely many twin primes). Also, I am wondering if my asymptotic formula is compatible with the first Hardy-Littlewood conjecture. It is, except maybe for the constant $C$, unless I am mistaken.
Finally, could this lead to a non-probabilistic, non-heuristic argumentation to help prove the twin prime conjecture? Or is what I discovered already well-known, or wrong, or non amenable to anything useful?