# Generating pairs of primes from the 2 previous primes.

Is every odd prime of the form $\,p+q\pm1\,$ for primes $\,p,q?\,$ This question arose as below.

First of, i have no idea if this is the right place to dump this "potential finding", but i have found no other forum or journal where i could submit this finding to and have it be debunked/validated/corrected/researched/burned/we.

Second of, first time posting in this community and several years ago since i asked a question in general on stack exchange, i'm a bit rusty.

So, let's get on with it:

to put it in one sentence: if $p$ contains at least 2 primes and $n$ is located at said primes $p[n+2]$ and $p[n+3]$ can be generated from $p[n]$ and $p[n+1]$ directly, provided you know $p[n-1], p[n-2],...,p[0]$ for checking purposes

How;

we have a list of our initial 2 prime numbers, called $primes$ which is also going to hold all the primes we generate; $primes = [2, 3]$

we generate a $candidate$ number by simply adding prime $n$ and $n+1$ together. $$candidate = primes[n] + primes[n+1]$$

we take this $candidate$ and generate 2 candidates from it called $candidate 1$ and $candidate 2$ by just subtracting one and adding one. we also make a third candidate from our original candidate, ill explain why that is needed to be done for a single edge case next.

$$candidate 1 = candidate - 1$$ $$candidate 2 = candidate + 1$$ $$candidate 3 = candidate$$

why the third candidate? all primes except 2 are UNEVEN ((why?, because when a number is considered prime, a multiple of it can't exist further up the list, 2 happens to be the first prime, 2 happens to be the first even number))

how does that work with our candidates? it means that for the majority of the time $candidate$ will be even, because $uneven + uneven = even$, which means that

$candidate 1 = even-1 = uneven = possible prime$ $candidate 2 = even+1 = uneven = possible prime$ $candidate 3 = even + 0 = even = don't bother$

since $candidate 3$ is equal to $candidate$ is is not worth checking if it's prime since it's even.

so for a majority of the time we only need to check for 2 candidates but when we do need to check the 3rd candidate is when your even becomes unevens and vise versa, then simply only check candidate 3, when is this even/uneven state flipped? anytime when $n$ or $n+1$ contain 2, because it throws the $uneven + uneven = even$ relationship to $even + uneven = uneven$

check if the uneven candidate(s) are prime, and if; add to the $primes$ list we are working with. and move forward in the $primes$ list, if no prime is found from the candidates then it means you WILL miss a prime either now or further up the line, which means that you should check the same n+1 number again but compare to $n-1$ instead of $n$. i have not confirmed this corner case though.

$2+3=5$, uneven, prime

$3+5=8$, even, $8-1=7$, prime. $8+1=9$, not prime

$5+7=12$ even, $12-1=11$, prime. $12+1=13$, prime

$7+11=18$ even, $18-1=17$, prime. $18+1=19$, prime

$11+13=24$ even, $24-1=23$, prime. $24+1=25$, not prime

$13+17=30$ even, $30-1=29$, prime. $30+1=31$, prime

$17+19=36$ even, $36-1=35$, not prime. $36+1=37$, prime

$19+23=42$ even, $42-1=41$, prime. $42+1=43$, prime

(note, we are generating more primes than what we are using to generate them, proof of infinite primes theory?)

and it just continues. i have not researched this anymore than fumbling with the theory in my head whilst on the toilet, so this might only hold for low $n$ or perhaps miss primes when larger $n$ is obtained

• Welcome to Math.SE. Please review How to Ask. We are expecting Questions that are more focused (less fumbling), queries that can be resolved by reasoned mathematical arguments in a reasonable amount of space. We encourage learning math at all levels, but the presentation of a "potential finding" doesn't really amount to a specific question. – hardmath Dec 1 '16 at 23:03
• This doesn't appear to be a question. Post it on your personal blog, then link to it in mathSE chat :) – 6005 Dec 1 '16 at 23:15
• Are you asking if every prime can be written as the sum of two primes $\pm 1,\,$ i.e. $\,p+q\pm 1\,$ as above? If so, you should make that question explicit. – Bill Dubuque Dec 1 '16 at 23:18
• @BillDubuque thank you, you condensed it even further, yes. that is basically it. specifically, any prime can be written as the sum of two primes +- 1 that's lower than the prime in question, hence a repeating generating structure. or am i totally out on the wrong limb there? – bbuubbi Dec 1 '16 at 23:21

For any odd number $m$, both $m - 1$ and $m + 1$ are even, so both $m + 1 = p + q$ and $m - 1 = r + s$, where $p, q, r, s$ and primes, so both $m = p + q - 1$ and $m = r + q + 1$ hold.