A trivial proof of Bertrand's postulate
Partial answer.
Conjecture 1: $b_0$ is the smallest prime larger than $n$.
Conjecture 2: $b_0$ is always a prime number as soon as $b_n$ is greater than $n+1$ and lower than some increasing bound. For a fixed $n$, all those prime values of $b_0$ make up a set of consecutive primes.
What is proved so far:
Regarding Conjecture 1
- If the bottom-right value is a prime, then it's the smallest prime larger than $n$.
- The conjecture is true when the gap between $n$ and the next prime is $|p-n|\leq 4$
Regarding Conjecture 2
The table below shows the range of $b_n$ values for which $b_0$ is a prime.
Proof of Conjecture 1 in the case where $n=p-1$ with $p$ prime.
The second row is $(p-2, p+(p-2))$, which are coprime numbers, and therefore by an immediate induction since $p$ is prime you can see that every subsequent row is of the form $$(a,p+a)$$ down to the last row $(0,p)$ as promised.$\,\,\square$
Proof in the case where $n=p-2$ with $p$ prime ($p>2$).
The second row is $(p-3, 2(p-2))$ and these two are not coprime: since $p>2$ is prime, $p-3$ is even. Therefore the third row is $(p-4, (p-4)+p)$ and from here we conclude the same way as before. $\,\,\square$
Proof in the case where $n=p-3$ with $p$ prime.
There you start to see some new arguments, where the proof is not constructive.
The second row is $(p-4, (p-4)+(p-2))$. They're coprime since $p$ is odd. You go down to $(p-5, (p-5)+(p-2))$. As long as you keep coprime pairs, you go down as $(p-k, (p-k)+(p-2))$. But the trick is that $p-2$ can't be prime, otherwise you wouldn't be in the case $n=p-3$, $p$ prime but rather $n=q-1$, $q$ prime (first case treated above) with $q=p-2$. So at the very least, when $a$ becomes a factor of $p-2$, you will get $(a,a+(p-2))$ and from there get down to $(a-1,(a-1)+(p-1))$.
From then on you can't stay at a difference $b-a=p-1$ for long, since $p-1$ is even. As soon as $a$ becomes even you will get up to $b-a=p$ and win.$\,\,\square$
Proof (sketch) in the case where $n=p-4$ with $p$ prime ($p>2$).
The proof for $n=p-3$ can be repeated: you're going to get rid of the difference $b-a=p-3$ very fast since $p$ is odd, you're getting rid of $b-a=p-2$ sooner or later since $p-2$ can't be a prime, and then you're getting rid of $b-a=p-1$ in at most two moves since $p$ is odd.$\,\,\square$
One problem in the general case is that you can't reverse-engineer the table, e.g. $(1,8)$ could come from $(2,8)$ or it could come from $(2,9)$.
If you add a column $b-a$, it starts at $n$, and goes non-decreasing. If it ever reaches a prime number, then it will stay at that prime number, since from then down you will have $(a=k, b=p+k)$ down to $(0,p)$ and the output will therefore be the smallest prime greater than $n$.
So all you've got to do is prove that you do reach a prime at some point. You could try to do that assuming Bertrand's postulate, it would already be some achievement.
The argument given makes no sense to me (and, judging from the comments, I'm not alone). To try to fix it, I suggest that you
- Use some notation which lets you talk unambiguously about different rows in the table. It's fairly standard to use subscripts for states in a process, so define $$b_a = \begin{cases} 2n & \textrm{if } a = n \\ b_{a+1} - [a+1, b_{a+1} \textrm{ coprime}] & \textrm{otherwise} \end{cases}$$
- Fix $2 \le p < q$ to be the smallest non-trivial factor of $q$ (assumed composite).
- Work up from $a=0$ to $a=p$ rather than beginning the argument at $a=p$.
But it's not going to be an easy task, because there are unstated assumptions which don't seem to be justified. In particular, the line
And if $p \mid q$, then $p \mid q+p$. But if it did, then because the right side would be unchanged on the next line $p-1$
seems to assume that if $b_0$ is composite with prime factor $p$ then $b_p = b_0 + p$. It's easy to derive a contradiction from "$b_0$ is composite with prime factor $p$ and $b_p = b_0 + p$". It's easy to show that if $p$ is the smallest prime factor of $b_p$ then $b_0 = b_p - p$. But neither of those is anywhere near sufficient: the goal is to derive a contradiction from the much simpler statement that $b_0$ is composite.
Edit: it's now claimed explicitly that $p | b_0$ implies $p | b_p$, but to me it looks like a proof by assertion. This needs much more detail to show that there's a justified argument.
Another issue which I think should be addressed is the strength of the argument. In particular, why should the same argument not hold when we change the definition to $b_n = n^2$? It's still the case that if $b_0$ is composite then it has a prime factor $p$ which has appeared in the first column, but under these starting conditions e.g. $n=10$ yields $b_0 = 95$.
Let me start by saying, this is awesome!
Here is a partial answer.
Let me call the number next to $i$ on the table $a_i$. Also, I would rather work with $b_i=a_i-i$. Notice that $$ \operatorname{gcd}(i, a_i) = \operatorname{gcd}(i, a_i -i) = \operatorname{gcd}(i, b_i). $$ As we go down the table, we follow the rules:
- $a_n = 2n$, so $b_n = n$.
- $a_{n-1} = 2n$, so $b_{n-1} = n+1$.
- If $(a_i, i) = 1$, then $a_{i-1} = a_i - 1$, so $b_{i - 1} = b_i$
- If $(a_i, i) \neq 1$, then $a_{i-1} = a_i$, so $b_{i - 1} = b_i + 1$
- At the end, $a_0 = b_0 = q$.
Now, if we look at the sequence $b_i$ as $i$ decreases, it will increase until it hits a prime and then it won't ever increase. I have no clue why it would reach this prime before $n$ steps.
I am like 85% confident on my coding skills and I think this works for all $n$'s up to $80000$. Also, if you look at the number of steps before you reach a prime, the numbers look half as long (as in it looks like the square root), so I am going to guess that the sequence reaches a prime pretty fast.