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?
This answer addresses only the question of the correctness of the congruential structure observed by OP. The pattern he reports is provably correct.
Consider composite numbers of the form $n=36m^2-1$. $n \text{ is a semiprime } \iff (6m-1,6m+1) \in \mathbb P \iff 6m-1,6m+1 \text { are twin primes} \\ n \text{ is not a semiprime } \Rightarrow n \text{ has at least one prime factor } p_i<6m-1 $
Theorem: If $p_i=6a \pm 1 \le 6m-1 \land p_i \mid 36m^2-1$, then $m \equiv \pm a \bmod p_i$.
Case 1: $$p_i=6a-1 \Rightarrow s_j=\frac{36m^2-1}{p_i}=6(a+k)+1 \\ 36m^2-1=36a^2+36ak+6a-6a-6k-1 \\ 36m^2=36a^2+36ak-6k$$ Since $36$ divides the LHS, $36$ must divide the RHS, so $k=6n,\ n \ge 0$. Substituting $$m^2=a^2+6an-n \\ m^2-a^2=(m-a)(m+a)=n(6a-1)=n\cdot p_i \\ m \equiv \pm a \bmod p_i$$
Case 2: $$p_i=6a+1 \Rightarrow s_j=\frac{36m^2-1}{s_i}=6(a+k)-1 \\ 36m^2-1=36a^2+36ak-6a+6a+6k-1 \\ 36m^2=36a^2+36ak+6k$$ Since $36$ divides the LHS, $36$ must divide the RHS, so $k=6n,\ n > 0$. Substituting $$m^2=a^2+6an+n \\ m^2-a^2=(m-a)(m+a)=n(6a+1)=n\cdot p_i \\ m \equiv \pm a \bmod p_i$$
Corollary: $6m-1,6m+1 \in \mathbb P \iff \forall a<m,\ m\not \equiv \pm a \bmod p_i$. Note that this corollary excludes the case $a=m$, for which $m\equiv a$ with respect to any modulus. If $m=a$ (whence $n=0$ and $b=a$) is the only instance where $m \equiv \pm a \bmod p_i$, then $6m-1,6m+1$ are twin primes.