# Can we remove any prime number with this strange process?

This is a little algorithm I made today, which may appear to be quite complex, so I will start with an example. Questions are at the end of the post.

The process goes as follows:

• Start with the first prime number, $$2$$.

• From $$2$$, add the next prime number ($$3$$) to get $$2+3=5$$. There are no non-trivial factors, so we move on.

• From $$2+3$$, add the next prime number ($$5$$) to get $$2+3+5=10$$. Since $$10=2\times5$$ and these two numbers appear in the sum, we remove $$2$$ and $$5$$.

• We are left with $$3$$.

• From $$3$$, add the next prime number ($$5$$) to get $$3+5=8$$. Now $$8=2\times2\times2$$, but $$2$$ does not appear in the sum, so we move on.

• From $$3+5$$, add the next prime number ($$7$$) to get $$3+5+7=15$$. Since $$15=3\times5$$ and these two numbers appear in the sum, we remove $$3$$ and $$5$$.

• We are left with $$7$$.

• (and so on)

So essentially, we keep on adding consecutive prime numbers until we reach a sum whose product contains some of those primes. We remove those primes and start the process once again. Great, except...

There is one more rule that needs to be added. If we continue doing this, we soon find ourselves in a rather strange scenario.

• (and so on) a continuation:

• From $$37+47+59+\cdots+241+251+257$$, add the next prime number ($$263$$) to get $$37+47+59+\cdots+251+257+263=5918.$$ Now $$5918=2\times11\times269$$, but neither of the three primes appear in the sum, so we move on.

• From $$37+47+59+\cdots+251+257+263$$, add the next prime number ($$269$$) to get $$37+47+59+\cdots+251+257+263+269=6187.$$ Since $$6187=23\times269$$ and $$269$$ appears in the sum, we remove $$269$$.

• We are left with $$37+47+59+\cdots+251+257+263$$.

This is a cycle! The sequence of $$263$$ and $$269$$ will continue forever, if we don't add another rule to this process. Therefore, I call $$269$$ a cyclic prime, and I propose this new rule.

• From $$37+47+59+\cdots+251+257+263$$, add the next non-cyclic prime number ($$271$$) to get $$37+47+59+\cdots+251+257+263+271=6189.$$ Now $$6189=2\times2063$$ and these two numbers do not appear in the sum, so we move on.

It is then natural to ask if there are primes that are cyclic only after more than one iteration. However, this is beyond the scope of both my knowledge and computation.

## Questions

1. Will every prime number in the sum eventually be removed? If not, which prime numbers will remain in the sum forever?

I believe the answer to this question is yes. The user @EuxhenH (with a few modifications) has kindly shared their code written in Python. From the program, it is found that all primes up to $$16903$$ are eliminated at some point before overflow.

The following table shows how long it takes (N iterations) for the smallest prime (not yet removed in the sum) P to be removed. Although the value of N fluctuates significantly, the general trend seems to be that it takes more iterations to remove a larger P.

   P: N
3: 2
7: 6
11: 7
23: 28
Found cyclic 269
37: 44
47: 48
71: 3
107: 47
109: 142
127: 232
181: 9
277: 247
431: 8
457: 316
479: 217
509: 969
773: 977
1069: 92
1123: 1327
1451: 2059
1483: 1270
1801: 542
Found cyclic 94793
2281: 3558

1. Are there infinitely many cyclic prime numbers? That is, are there infinitely many $$n$$ such that $$p_{n+1}\,\Bigg\vert\,\sum_{p_i\in\text{sum}} p_i\,?$$

I believe the answer to this question is no. As of writing, the only known cyclic prime numbers are $$269$$ and $$94793$$ so they are rather rare to find.

Any further input will be much appreciated.

• How can you possibly know which next prime is non-cyclic? I don't think this part is computable, unless there is some hidden proof or trick. – EuxhenH Jul 8 at 12:31
• @EuxhenH If $\require{cancel}p_{n+1}\,\cancel{\Bigg\vert}\,\sum_{p_i\in\text{sum}} p_i$ where $\text{sum}$ is the existing sum, then we know that the next prime cannot be cyclic since the factors of $\text{sum}$ do not include the next prime. – TheSimpliFire Jul 8 at 12:37
• @EuxhenH Good point. We can discuss further in my chatroom :) – TheSimpliFire Jul 8 at 13:14
• Can someone explain the downvotes? – TheSimpliFire Jul 12 at 6:38
• I have a probabilistic interpretation for the first question, this is not a demonstration, just an intuition on why this might be true. Take a prime p in the sum, by dirichlet theorem for any 0<k<p there are infinitely many primes that are congruent to k mod p, as a result if you consider that you pick your next prime at random, you have a positive probability that the sum will be a multiple of p and so almost surely, you end up on a multiple of p. In our case, the next prime we add isn't chosen at random so I'll say it again, this is not a proof, just an intuition. – Statistic Dean Aug 20 at 12:06