In my previous post, I made a modification to the following algorithm:
Suppose we take any positive integer \(n \gt 1\)
- if prime, double it and add 1: \(n \rightarrow 2n+1\)
- if composite, determine its number of divisors \(d\)
- if \( n \pmod d \equiv 0\) then \(n \rightarrow \dfrac{n}{d} \)
- if \( n \pmod d \not\equiv 0 \) then \(n \rightarrow n \times d\)
Keep repeating this process until a loop is reached or call a stop after a fixed number of iterations.
The modification I made prevented the numbers generated from becoming too large too quickly. Instead of doubling a prime and adding 1, I decided to do this only if the number was a \(4k+1\) prime. If it was a \(4k+3\), I subtracted 1 and divided by 2. The new algorithm looks like this:
- if a \(4k+1\) prime, double it and add 1: \(n \rightarrow 2n+1\)
- if a \(4k+3\) prime, subtract 1 and divide by 2: \(n \rightarrow (n-1)/2\)
- if composite, determine its number of divisors \(d\)
- if \( n \pmod d \equiv 0\) then \(n \rightarrow \dfrac{n}{d} \)
- if \( n \pmod d \not\equiv 0 \) then \(n \rightarrow n \times d\)
--- Loop detected at value 149708 ---Divisors to Sequence:28069, 56139, 224556, 18713, 37427, 149708, 1796496, 71859840, 561405, 8982480, 112281, 898248, 28743936, 2069563392, 10778976, 149708------------------------------Sequence Length: 16Highest Value: 2069563392
- if a \(4k+1\) prime, double it and add 1: \(n \rightarrow 2n+1\)
- if a \(4k+3\) prime, subtract 1 and divide by 2: \(n \rightarrow (n-1)/2\)
- if composite, determine its number of factors \(f\) counted \( \textbf{with multiplicity}\)
- if \( n \pmod f \equiv 0\) then \(n \rightarrow \dfrac{n}{f} \)
- if \( n \pmod f \not\equiv 0 \) then \(n \rightarrow n \times f\)
--- Loop detected at value 37427 ---Number of factors to sequence with multiplicity:28069, 56139, 112278, 37426, 18713, 37427, 74854, 224562, 898248, 149708, 37427--------------------Sequence Length: 11
Highest Value: 898248
- if a \(4k+1\) prime, double it and add 1: \(n \rightarrow 2n+1\)
- if a \(4k+3\) prime, subtract 1 and divide by 2: \(n \rightarrow (n-1)/2\)
- if composite, determine its number of factors \(f\) counted \( \textbf{without multiplicity}\)
- if \( n \pmod f \equiv 0\) then \(n \rightarrow \dfrac{n}{f} \)
- if \( n \pmod f \not\equiv 0 \) then \(n \rightarrow n \times f\)
--- Loop detected at value 224562 ---28069, 56139, 112278, 37426, 18713, 37427, 74854, 224562, 898248, 224562--------------------Sequence Length: 10Highest Value: 898248







