Simple recurrence relation to yield nearby prime

48 Views Asked by At

Let $S_1=n>4$, and take

$$S_{i+1}:=S_i+\mathrm{lpf}(S_i-\mathrm{gpf}(S_i))$$

until the value no longer changes, and it seems to yield a prime $n \leq p \leq 2n+1$. Similarly, you can take

$$S_{i+1}:=S_i-\mathrm{lpf}(S_i-\mathrm{gpf}(S_i))$$

and you'll end up with a prime $n/2-1 \leq p \leq n$.

In the equations above, $\mathrm{lpf}$ and $\mathrm{gpf}$ refer to least and greatest prime factors respectively, as in $\mathrm{lpf}(45)=3$ and $\mathrm{gpf}(45)=5$.

I'm curious whether this is provable, particularly if it avoids using Bertrand's postulate or an equivalent principle. But more realistically, I'm curious if this is just a case of my obfuscating some trivial operation.