Tuesday, 27 January 2026

Number's Factors to Sequence Algorithm 1

Suppose we take any positive integer \(n \gt 1\) and apply the following rules to it:
  • if prime, double it and add 1: \(n \rightarrow 2n+1\)
  • if composite, determine its number of factors \(f\) counted 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\)
Keep repeating this process until a loop is reached or call a stop after a fixed number of iterations. Let's use 28058 as an example. The sequence generated is 28058, 14029, 28059, 9353, 18706, 56118, 224472, 37412, 9353 and the details are as follows:

  • \(28058 = 2 \times 14029\) and there are two factors
    2 divides 28056 to give 14209

  • \(14029\) is prime
    multiplying by 2 and adding 1 we get 28059

  • \(28059 = 3 \times 47 \times 199\) and there are three factors
    3 divides 28059 to give 9353

  • \(9353 = 47 \times 199\) and there are two factors but 2 doesn't divide 9353
    multiplying by 2 gives 18706

  • \(18706 = 2 \times 47 \times 199\) and there are three factors but 3 doesn't divide 18706
    multiplying by 3 gives 56118

  • \(56118 = 2 \times 3 \times 47 \times 199\) and there are four factors but 4 doesn't divide 56118
    multiplying by 4 gives 224472

  • \(224472 = 2^3 \times 3 \times 47 \times 199\) and there are six factors (with multiplicity)
    6 divides 224472 to give 37412

  • \(37412 = 2^2 \times 47 \times 199\) and there are four factors (with multiplicity)
    4 divides 37412 to give 9353

  • \(9353\) occurred earlier in the sequence and so we have a loop
Figure 1 shows the trajectory.


Figure 1

Some numbers return to their starting points. 27056 is one such number. It's sequence is 28056, 4676, 1169, 2338, 7014, 28056. What appeals to me about this sequence is that it is \( \textbf{base independent}\). Here is permalink to generate the sequence of any number entered into it.

An investigation into what numbers produced sequences of record lengths returned the following number in the range up to one million:

2, 3, 6, 8, 13, 19, 38, 57, 76, 304, 1024, 1579, 2401, 3584, 10331, 12119, 12500, 15379, 24251, 30689, 48661, 57122, 66749, 116603, 155201, 232801, 465602, 698403, 931204

The final number in the list (931204) produces a sequence of length 155. Here are the full details for all the numbers in the list (permalink):
2 --> 11
3 --> 15
6 --> 16
8 --> 18
13 --> 20
19 --> 24
38 --> 25
57 --> 27
76 --> 29
304 --> 32
1024 --> 34
1579 --> 40
2401 --> 43
3584 --> 49
10331 --> 51
12119 --> 53
12500 --> 61
15379 --> 64
24251 --> 65
30689 --> 66
48661 --> 69
57122 --> 92
66749 --> 105
116603 --> 145
155201 --> 146
232801 --> 150
465602 --> 151
698403 --> 153
931204 --> 155

The sequence for 931204 is as follows: 

931204, 2793612, 698403, 1396806, 465602, 232801, 465603, 931206, 310402, 155201, 310403, 1241612, 7449672, 931209, 4656045, 27936270, 223490160, 2458391760, 204865980, 1843793820, 167617620, 16761762, 134094096, 1475035056, 122919588, 13657732, 95604124, 764832992, 69530272, 695302720, 8343632640, 556242176, 7231148288, 516510592, 6198127104, 92971906560, 5468935680, 341808480, 28484040, 256356360, 2819919960, 234993330, 26110370, 182772590, 1462180720, 132925520, 13292552, 1661569, 8307845, 49847070, 398776560, 4386542160, 365545180, 3289906620, 299082420, 29908242, 239265936, 2631925296, 219327108, 1973943972, 179449452, 1794494520, 149541210, 16615690, 2373670, 14242020, 113936160, 1253297760, 104441480, 939973320, 85452120, 8545212, 68361696, 751978656, 62664888, 563983992, 51271272, 512712720, 42726060, 4747340, 33231380, 265851040, 2924361440, 35092337280, 2339489152, 179960704, 2159528448, 32392926720, 550679754240, 30593319680, 458899795200, 26994105600, 1687131600, 140594300, 1265348700, 115031700, 11503170, 92025360, 1012278960, 84356580, 759209220, 69019020, 6901902, 55215216, 607367376, 50613948, 5623772, 803396, 4820376, 602547, 3012735, 18076410, 144611280, 13146480, 1314648, 164331, 821655, 4929930, 39439440, 433833840, 36152820, 4016980, 28118860, 224950880, 20450080, 2045008, 255626, 1278130, 7668780, 61350240, 674852640, 56237720, 506139480, 46012680, 4601268, 36810144, 404911584, 33742632, 303683688, 27607608, 276076080, 23006340, 2556260, 365180, 2191080, 273885, 54777, 219108, 36518, 146072, 876432, 109554, 547770, 91295, 365180

The range of values in this sequence is extreme, ranging from a minimum of 36,518 to a maximum of 550,679,754,240. Figure 2 shows the trajectory with a log scale being necessary for the \(y\) axis.


Figure 2

No comments:

Post a Comment