Showing posts with label iteration. Show all posts
Showing posts with label iteration. Show all posts

Sunday, 23 February 2025

Celebrating 27720

It's not often that numbers as large as 27720 attract 632 entries in the Online Encycopedia of Integer Sequences (OEIS). By contrast, 27719 attracts 31 entries and 27721 attracts 27 entries. So what's so special about 27720?


Well, it has lots of interesting properties. Let's look at some of them. 

\( \textbf{PROPERTY 1} \)

The very first entry in the database is OEIS A002182:


A002182  Highly composite numbers: numbers \(n\) where d(\(n\)), the number of divisors of \(n\)  increases to a record.

The initial record holders, up to 40000, are as follows where we see 27720 is a member:

1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260, 1680, 2520, 5040, 7560, 10080, 15120, 20160, 25200, 27720

Table 1 shows the details:

Table 1: permalink

\( \textbf{PROPERTY 2} \)

In a similar vein is OEIS A004394 where 27720 also features:


A004394    superabundant numbers: \(n\) such that \( \sigma(n)/n > \sigma(m)/m \) for all \( m < n\), \( \sigma(n)\) being A000203(n), the sum of the divisors of \(n\).

The initial members are as follows with most being the same as for OEIS A002182:

1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260, 1680, 2520, 5040, 10080, 15120, 25200, 27720

Table 2 shows the details:

Table 2: permalink

\( \textbf{PROPERTY 3} \)

Another interesting property of the number arises from its appearance in the denominator of the progressive sum of the harmonic numbers. These denominators constitute OEIS A002805.


A002805
    denominators of harmonic numbers \( \text{H}(n) =\displaystyle \sum_{i=1} ^n \dfrac{1}{i} \)

The first terms in the sequence are 1, 2, 6, 12, 60, 20, 140, 280, 2520, 2520, 27720, 27720. Table 3 shows the details.

Table 3: permalink

\( \textbf{PROPERTY 4} \)

The number also arises from a quite simple recurrence relation:


A052542     \( \text{a}(n) = 2 \times \text{a}(n-1) + \text{a}(n-2), \text{ with } \text{a}(0) = 1, \text{a}(1) = 2, \text{a}(2) = 4 \)

The initial members of the sequence are 1, 2, 4, 10, 24, 58, 140, 338, 816, 1970, 4756, 11482, 27720 (permalink).

\( \textbf{PROPERTY 5} \)

Since \(27720 = 2^3 \times 3^2 \times 5 \times 7 \times 11 \), it is 12 times the product of the primorial number \(2310 = 2 \times 3 \times 5 \times 7 \times 11 \) and this qualifies it for membership in OEIS A129912 because 12 is itself a product of primorials viz. 2 x 6.


A129912 numbers that are products of distinct primorial numbers (see A002110).

The initial members of the sequence (with the primorials themselves included) can be generated using this permalink:

1, 2, 6, 12, 30, 60, 180, 210, 360, 420, 1260, 2310, 2520, 4620, 6300, 12600, 13860, 27720, 30030, 37800

Initially I misinterpreted this sequence as meaning numbers that are multiples of primorials but this is not the case. Instead the multiples themselves must be products of primorials and this is far more restrictive.

Tuesday, 5 March 2024

Recursive Sum of Prime Factors

On Saturday the 21st of August 2021, I posted about composite numbers that become prime after repeated iterations of f(\(x\)) = sum of prime factors of \(x\) considered with and without multiplicity. The post was titled Analysis of a Recursive Process. I was reminded of these types of numbers due to one of the properties of the number associated with my diurnal age today. The number is 27364 and it is a member OEIS A047827:


 A047827

Numbers that become prime after exactly 8 iterations of f(\(x\)) = sum of prime factors of \(x\) where multiplicity is ignored.



It's good to revisit this important topic because this is only the second post that I've made about it over the years. There are only 18 such numbers in the range up to 40,000 and these are:

13682, 18002, 19137, 22934, 24014, 24787, 27364, 27849, 30062, 30993, 32577, 33477, 35410, 35798, 36004, 36398, 36706, 39206

In the case of 27364 the progression is shown in Figure 1 where "sopf" stands for "sum of prime factors" taken without regard to multiplicity.


Figure 1

It's interesting to look at the statistics regarding the number of iterations required by composite numbers to reach a prime number using the sum of prime factors. In my first post, my statistics extended only to 100,000 but in this post I'll extend the range to one million. What do we find? Here are links to two different algorithms for extracting this information (permalink1 and permalink2).
  • 1 iteration:   107551
  • 2 iterations: 125340
  • 3 iterations:  221225
  • 4 iterations:  237764
  • 5 iterations:  144624
  • 6 iterations:     62205
  • 7 iterations:     18951
  • 8 iterations:       3416
  • 9 iterations:          397
  • 10 iterations:          26
  • 11 iterations:             2
  • 12 iterations:             0
Presumably there will be numbers larger than one million for which 12 iterations are possible and I assume the sequence is infinite. However, SageMathCell struggles above the one million mark, so that's as far as I can go. However, the two numbers less than one million for which 11 iterations are possible are 334142 and 668284. The table below shows the stages for the larger number to give an idea of the progression:

     number   factorisation         prime factors       sopf 
 
  668284   2^2 * 167071    [2, 167071]     167073
  167073   3 * 55691       [3, 55691]      55694
  55694    2 * 27847       [2, 27847]      27849
  27849    3 * 9283        [3, 9283]       9286
  9286     2 * 4643        [2, 4643]       4645
  4645     5 * 929         [5, 929]        934
  934      2 * 467         [2, 467]        469
  469      7 * 67          [7, 67]         74
  74       2 * 37          [2, 37]         39
  39       3 * 13          [3, 13]         16
  16       2^4             [2]             2

So this post is focused on the iterations where the multiplicity of the prime factors is ignored. For iterations where multiplicity is counted refer back to my earlier post Analysis of a Recursive Process.

Saturday, 28 January 2023

Iteration: Reverse and Subtract Maximum Digit

Today I turned 26963 days old and one of the interesting properties of this number is that it's a member of OEIS  A097155:


 A097155

Numbers that reach the fixed point 89 under iteration of f(x) = reverse(x) - maxdigit(x).



In the range up to 40,000, there are only 45 numbers with this property. They are:

89, 890, 998, 2125, 3126, 5207, 6207, 7018, 7019, 8099, 8900, 9098, 9899, 9980, 10151, 10152, 10224, 12205, 12259, 12268, 14085, 14086, 15095, 15096, 17972, 18971, 21250, 22015, 22269, 23077, 24005, 24086, 24087, 25096, 26963, 27962, 30225, 31116, 31260, 33006, 33077, 33078, 34087, 35954, 36953

The remaining 39955 numbers end in zero. Here is a permalink to the calculation that generated these numbers. Let's follow the trajectory of 26963 (permalink):

26963, 36953, 35954, 45944, 44945, 54935, 53936, 63926, 62927, 72917, 71918, 81908, 80909, 90899, 99800, 890, 89

ONLY 0 AND 89 REMAIN INVARIANT
UNDER THE OPERATION OF
REVERSE AND SUBTRACT LARGEST DIGIT

Figure 1 shows the trajectory of 26963. Note how 99800 collapses to 899 when it's reversed, leading quickly to 89.


Figure 1: trajectory of 26963

Compare this trajectory to that 26962 (see What's Special About 26962?) and most other numbers (permalink):

26962, 26953, 35953, 35944, 44944, 44935, 53935, 53926, 62926, 62917, 71917, 71908, 80908, 80899, 99799, 99790, 9790, 970, 70, 0

Figure 2 shows the trajectory of 26962 which is similar to that of 26963, except that it collapses to 0.


Figure 2: trajectory of 26962

If we look at the numbers corresponding to the dates in 2023 (see Turning Dates Into Numbers), there are only two numbers that lead to in 89 and these are (permalink):
  • 20230213 corresponding to the 13th February 2023
  • 20231112 corresponding to the 12th November 2023
The numbers corresponding to the other 363 dates all end in zero.

In the range up to 100,000, there are 124 numbers that end in 89 making for a percentage of 0.124% (permalink). Figure 3 shows the distribution of these numbers over the range.


Figure 3

Wednesday, 4 January 2023

What's Special About 256409?

 My diurnal age today, 26939, has the property that:

  • 2 x 26939 + 3 = 53881 is prime
  • 4 x 26939 + 5 = 107761 is prime
  • 6 x 26939 + 7 = 161641 is prime
  • 8 x 26939 + 9 = 215521 is prime

  • It thus belongs to a sequence of numbers \(n\) with the property that  \(2n+3\), \(4n+5 \), \(6n+7\) and \( 8n+9\) are all prime (A105653). The initial members of the sequence are:

    164, 764, 1529, 2129, 2474, 3419, 5414, 7694, 9059, 11504, 12704, 13019, 15884, 16649, 20054, 20744, 22529, 24914, 26939, 29669, 32924, 35069, 36884, 39269

    It's interesting to see how far we can extend this property. How many numbers will also yield a \(10n+11\) that is prime? Extending the range to one million, it can be seen that a quite a few numbers do qualify. They are:

    5414, 12704, 13019, 44369, 82949, 98279, 105524, 112199, 115139, 123854, 134249, 134459, 187739, 188744, 210164, 225704, 247169, 256409, 296309, 302084, 367874, 375644, 382889, 399584, 404039, 476339, 487829, 526844, 532094, 566429, 578084, 766184, 779789, 787709, 854174, 883889, 919334, 966839

    What about \(12n+13\) as well? The result is quite a few less. In fact only 12704, 13019, 105524, 256409 and 966839 qualify.

    256409

    When we try \(14n+15\), there is only one man left standing and that is 256409. Can this number go one further to \(16n+17\)? Indeed it can but at \(18n+19\), it fails. Here is a list of the primes produced along with the final composite number (all end in the digit 1) where "True" represents a prime number and "False" represents a composite number (permalink).
    • 2 x 256409 + 3 = 512821 True
    • 4 x 256409 + 5 = 1025641 True
    • 6 x 256409 + 7 = 1538461 True
    • 8 x 256409 + 9 = 2051281 True
    • 10 x 256409 + 11 = 2564101 True
    • 12 x 256409 + 13 = 3076921 True
    • 14 x 256409 + 15 = 3589741 True
    • 16 x 256409 + 17 = 4102561 True
    • 18 x 256409 + 19 = 4615381 False
    So it is for this reason that 256409 is rather special, at least in the range of positive integers up to one million. It is in fact the first member of OEIS A105657 containing numbers with the same property as 256409 but none of them can be the first! Here are the initial members of the sequence:

    256409, 11120339, 13243229, 49798979, 296504669, 510578774, 520649219, 640598279, 674992499, 713074004, 830453714, 947378984

    It can be noted that while the initial members all end in 9, the last three listed all end in 4. Even so the primes produced still end in 1 as 2 x 4 + 3 = 11 and 2 x 9 + 3 = 21 etc.. Take the final member listed, 947378984, as an example:
    • 2 x 947378984 + 3 = 1894757971 True
    • 4 x 947378984 + 5 = 3789515941 True
    • 6 x 947378984 + 7 = 5684273911 True
    • 8 x 947378984 + 9 = 7579031881 True
    • 10 x 947378984 + 11 = 9473789851 True
    • 12 x 947378984 + 13 = 11368547821 True
    • 14 x 947378984 + 15 = 13263305791 True
    • 16 x 947378984 + 17 = 15158063761 True
    • 18 x 947378984 + 19 = 17052821731 False
    There's no reason to suppose that there are not numbers out there that would extend the primes generated to \(18n+19\) and beyond. Using a Jupyter Notebook, a search to ten million produced nothing and, extending the search to one hundred million, the Notebook experienced a meltdown. So for the time being, 947378984 remains the largest member of the sequence and 256409 its smallest.

    ******************************************

    Another interesting property of 256409 is that it has no repeating digits and, of the members of OEIS A105657 listed previously, it is the only such number. All the other numbers have at least one repeating digit. This is not all that surprising given that the other numbers have eight and nine digits and so the probability of a repeating digit is high. Any six digit number such as 256409, if digits are assigned randomly, will have a smaller probability of digits repeating. 

    ******************************************

    256409 is a sphenic number which means that it has three distinct prime factors, in this case 43, 67 and 89. Now if the primes between 43 and 89 are listed, we see the following:

    43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89

    There are four primes between 43 and 67 and four primes also between 67 and 89. How often does this symmetry occur in sphenic numbers? We might ask it in the following way:
    If \(n\) is a sphenic number with factors \(p_1\), \(p_2\) and \(p_3\), what numbers have the property that their primes indices are in arithmetic progression?
    For example, the indices of 43, 67 and 89 are 14, 19 and 24 respectively and the latter three numbers are in arithmetic progression.

    Well, in the range up to one million, there are 206964 sphenic numbers, a little over 20%. In that range only 601 satisfy the previously mentioned criteria and as we have seen 256409 is one of them. If we specify that the common difference must be 5, then only 21 numbers satisfy and these are (permalink):

    806, 1887, 3895, 6923, 14993, 21359, 37111, 47519, 66263, 96773, 119939, 172457, 207583, 256409, 323689, 390769, 480083, 541741, 649967, 778231, 936371

    Saturday, 21 May 2022

    Iterations of a Ceiling Function

    It was back when I turned 26671 days old on April 11th 2022 that I first came across an unusual function that when applied repeatedly, so that the output becomes the new input, leads to zero or a loop. Here is the function \( n \) is any integer \( \ge 1\):$$\lceil \sqrt{n} \, \rceil \times (\lceil \sqrt{n}\, \rceil^2 – n) $$It can be seen that, with when \( n \) is a square number, the value of the expression is zero. When applied to most numbers, the iteration leads to zero but, far less frequently, the sequence of numbers generated by the iteration leads to a loop. 26671 is one such number. It has the following trajectory:

    26671, 36900, 67357, 63180, 81648, 42328, 22248, 37800, 43875, 47250, 59732, 71785, 10452, 16171, 27264, 48472, 81549, 70642, 30324, 52675, 51750, 53352, 2079, 1702, 2604, 5200, 9417, 18326, 23120, 44217, 64144, 94488, 115808, 161293, 125022, 104076, 81719, 22022, 26671

    Thus we end up where we began, but this is not always the case as we shall see. The reason that I was reminded of this function is that today I turned 26710 days old and this number also has the property that it does not end in zero under repeated iterations but instead enters a loop. In the case of 26710, the loop is:

    26710, 30504, 21175, 20586, 21600, 1323, 1702, 2604, 5200, 9417, 18326, 23120, 44217, 64144, 94488, 115808, 161293, 125022, 104076, 81719, 22022, 26671, 36900, 67357, 63180, 81648, 42328, 22248, 37800, 43875, 47250, 59732, 71785, 10452, 16171, 27264, 48472, 81549, 70642, 30324, 52675, 51750, 53352, 2079, 1702

    Here it can be seen that the number does not return to its starting point but instead enters a loop beginning and ending with 1702. Interestingly, 26709 also enters a loop as well. The loop is:

    26709, 30668, 54208, 18873, 23598, 18172, 7155, 5950, 10452, 16171, 27264, 48472, 81549, 70642, 30324, 52675, 51750, 53352, 2079, 1702, 2604, 5200, 9417, 18326, 23120, 44217, 64144, 94488, 115808, 161293, 125022, 104076, 81719, 22022, 26671, 36900, 67357, 63180, 81648, 42328, 22248, 37800, 43875, 47250, 59732, 71785, 10452

    Such pairs are not all that common. The pairs up to this point are as follows:

    (2222, 2223), (8399, 8400), (11457, 11458), (12950, 12951), (19005, 19006), (19847, 19848),
    (22444, 22445), (23597, 23598), (25089, 25090), (25175, 25176), (25742, 25743), (26709,
    26710)

    Overall, the numbers that do not become zero constitute about 1.94% of the numbers in the range between 1 and 26710. These numbers constitute OEIS A219960 and the members up to 26710 are:

    366, 680, 691, 1026, 1136, 1298, 1323, 1417, 1464, 1583, 1604, 1702, 2079, 2125, 2222, 2223, 2374, 2507, 2604, 2627, 2821, 2844, 2897, 3152, 3157, 3159, 3183, 3210, 3231, 3459, 3697, 3715, 3762, 3802, 3866, 3888, 3936, 3948, 4004, 4111, 4133, 4145, 4231, 4299, 4388, 4414, 4614, 4653, 4683, 4685, 4780, 4794, 4815, 5004, 5025, 5084, 5103, 5130, 5193, 5200, 5244, 5342, 5382, 5453, 5509, 5513, 5515, 5524, 5529, 5558, 5707, 5793, 5832, 5877, 5888, 5902, 5950, 5980, 5989, 6015, 6103, 6129, 6205, 6295, 6310, 6335, 6447, 6469, 6489, 6498, 6513, 6522, 6662, 6676, 6767, 6788, 6956, 7009, 7025, 7063, 7095, 7152, 7155, 7200, 7217, 7258, 7261, 7397, 7408, 7410, 7420, 7422, 7452, 7460, 7463, 7469, 7575, 7625, 7751, 7937, 7942, 7947, 7971, 8020, 8043, 8112, 8150, 8163, 8237, 8250, 8335, 8383, 8399, 8400, 8407, 8503, 8621, 8700, 8762, 8785, 8794, 8848, 8947, 8971, 9141, 9175, 9222, 9234, 9332, 9352, 9417, 9452, 9483, 9499, 9663, 9754, 9763, 9780, 9841, 9913, 9916, 9928, 9948, 10031, 10118, 10126, 10134, 10179, 10211, 10221, 10232, 10245, 10269, 10290, 10357, 10431, 10452, 10472, 10546, 10673, 10738, 10766, 10835, 10844, 10851, 10866, 10902, 10927, 10945, 11050, 11077, 11083, 11086, 11149, 11166, 11238, 11246, 11404, 11419, 11457, 11458, 11460, 11464, 11551, 11595, 11610, 11628, 11729, 11794, 11858, 11868, 11921, 12025, 12204, 12411, 12465, 12469, 12574, 12606, 12661, 12716, 12775, 12784, 12789, 12821, 12894, 12915, 12931, 12939, 12950, 12951, 12963, 12987, 12997, 13019, 13173, 13327, 13381, 13465, 13475, 13512, 13578, 13602, 13643, 13662, 13670, 13722, 13770, 13833, 13913, 13966, 13980, 14007, 14073, 14111, 14189, 14220, 14330, 14340, 14459, 14466, 14543, 14662, 14670, 14673, 14731, 14801, 14872, 14881, 14896, 14964, 15024, 15097, 15130, 15195, 15217, 15335, 15355, 15379, 15406, 15559, 15564, 15608, 15668, 15731, 15891, 15900, 16171, 16191, 16218, 16338, 16388, 16417, 16438, 16505, 16525, 16549, 16551, 16568, 16586, 16681, 16695, 16707, 16715, 16815, 16843, 16854, 16860, 16975, 17070, 17164, 17170, 17461, 17474, 17539, 17544, 17577, 17648, 17718, 17728, 17763, 17878, 17882, 17972, 18008, 18026, 18065, 18123, 18139, 18172, 18187, 18270, 18326, 18334, 18367, 18402, 18419, 18423, 18491, 18534, 18546, 18666, 18716, 18854, 18873, 18882, 18945, 18958, 18965, 18990, 19005, 19006, 19127, 19253, 19285, 19330, 19356, 19540, 19547, 19674, 19677, 19686, 19690, 19716, 19735, 19847, 19848, 19853, 19894, 19950, 19972, 20156, 20187, 20195, 20206, 20209, 20295, 20345, 20421, 20524, 20554, 20583, 20586, 20686, 20709, 20749, 20803, 20892, 20899, 20965, 21121, 21175, 21223, 21248, 21324, 21332, 21426, 21451, 21522, 21539, 21600, 21618, 21622, 21627, 21721, 21837, 21857, 21929, 22009, 22020, 22022, 22032, 22035, 22114, 22153, 22164, 22248, 22254, 22295, 22356, 22367, 22394, 22442, 22444, 22445, 22452, 22577, 22813, 22903, 22945, 22995, 23006, 23118, 23120, 23138, 23205, 23221, 23226, 23265, 23287, 23303, 23319, 23333, 23470, 23573, 23597, 23598, 23639, 23648, 23690, 23789, 23836, 24050, 24116, 24168, 24269, 24284, 24352, 24366, 24392, 24441, 24546, 24704, 24711, 24734, 24793, 24817, 24874, 24895, 24908, 24946, 25038, 25072, 25076, 25089, 25090, 25129, 25157, 25175, 25176, 25179, 25181, 25194, 25223, 25236, 25320, 25336, 25465, 25555, 25640, 25675, 25698, 25708, 25727, 25742, 25743, 25834, 25862, 25930, 25945, 26106, 26108, 26159, 26187, 26198, 26208, 26220, 26306, 26456, 26479, 26506, 26509, 26519, 26526, 26650, 26665, 26671, 26709, 26710

    There are a number of conjectures associated with this ceiling function. These are listed in the OEIS comments and are:

    Conjecture 1: All numbers under the iteration reach 0 or, like the elements of this sequence, reach a finite loop, and none expand indefinitely to infinity.

    Conjecture 2: There are an infinite number of such finite loops, though there is often significant distance between them.

    Conjecture 3: There are an infinite number of pairs of consecutive integers.

    Friday, 25 March 2022

    Odds 'n Evens Visualisation

    I've written about the behaviour of numbers under the repeated application of the odds and evens rule in numerous posts but I'll recapitulate the rule here:

    • start with an number
    • any even digits are given a negative face value
    • any odd digits are given a positive face value
    • find the sum of the face value of the digits
    • add this sum to the number to generate a new number
    • repeat the process until a fixed value or a loop is reached
    As an example, consider the number 111. Under the above rules we have, 111 --> 111+3 --> 114-2 --> 112 and a fixed value has been reached because 112 is invariant under the rule. Take 13 as an another example. The progression here is 13 --> 13+4 --> 17+8 --> 25+3 --> 28-10 --> 18-7 --> 11+2--> 13 and we are back where we started.


    What I've attempted to do in Figure 1 is to show the behaviour of the numbers from 1 to 256 by inserting them into a 16 x 16 grid. I'll now explain the significance of the colours used.


    Figure 2

    Referring to Figure 2 : 1, 2, 3, 4, 6 and 8 are in white squares. These numbers all reach zero in one or two iterations. Thus for them 0 is the fixed point, although it is not marked on the grid. 5, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26 and 28 are all coloured the same but some numbers are bold and noticeably larger. These numbers (11, 13, 17, 18, 25 and 28) form a loop and the other numbers (smaller and not bold) will end up in this loop after repeated applications of the odds 'n evens rule. I've chosen the term vortices (plural of vortex) for such loops and vorticals for the numbers that comprise them. The numbers that fall into the loop are captives.

    ********************************************************************************


    Figure 3

    Referring to Figure 3 : the next numbers are in blue coloured squares and are clearly the most numerous. There is only one number that is bold and larger than the others. That number is 134 and it is invariant under the rule. All the other blue numbers have trajectories that lead to 134. I've chosen to call numbers like 134 attractors and the numbers that lead to them I've called captives.

    ********************************************************************************


    Figure 4

    Referring to Figure 4 : the next loop is made up of the numbers 54, 55, 64 and 65 and all the other similarly coloured numbers will end up in this loop or vortex.

    ********************************************************************************


    Figure 5

    Referring to Figure 5 : 112 is a number that is invariant under the rule and all the other similarly coloured numbers have trajectories that lead to 112. Having the same digits as 112 is 121 and so this too is a number that is also invariant under the rule. It has been made bold and larger but its square is left white because no other numbers have trajectories that lead to it. Similarly, 143, 156, 165, 187 and 211 are singletons and have no connections to the numbers around them. In the past I've called such numbers attractors, even though no other numbers are attracted to them. The preferable term might be isolates.

    ********************************************************************************


    Figure 6

    Referring to Figure 6 : 137 and 148 are larger and bold because they form a loop and the other similarly coloured numbers will all end up in this loop or vortex. These two number loops as we will see are fairly common.

    ********************************************************************************


    Figure 7

    Referring to Figure 7 : 155 and 166 similarly form a loop or vortex and all the other grey coloured numbers will enter this loop.

    ********************************************************************************


    Figure 8

    Referring to Figure 8 : 156 is invariant under the rule and all yellow coloured numbers have trajectories leading to 156. I've chosen the term attractor to describe numbers such as 156.

    ********************************************************************************


    Figure 9

    Referring to Figure 9 : 173 and 184 form a loop or vortex and the other brown coloured numbers will end up in this loop. 178 is invariant under the rule and other red coloured numbers have trajectories leading to 178. I've chosen to use the term attractor for numbers like 178.

    ********************************************************************************


    Figure 10

    Referring to Figure 10 : 198 and 200 form a loop and the other pink coloured numbers will end up in this loop or vortex.

    ********************************************************************************


    Figure 11

    Referring to Figure 11 : 209 and 216 form a loop and the other green coloured numbers will end up in this loop or vortex.

    ********************************************************************************


    Figure 12

    Referring to Figure 12 : 231, 233, 237, 245, 244 and 234 form a loop or vortex into which all the other similarly coloured numbers will end up. 239 and 249 to 256 have trajectories leading to a loop that is beyond the grid so they have been made grey.

    The intention of this visualisation was to provide an overview of the behaviour of the first 256 counting numbers under the odds 'n evens rule. As can be clearly seen the numbers fall into various categories:
    • attractors: these are numbers that are invariant under the odds 'n evens rule and the trajectories of one or more other numbers (called captives) lead to them e.g. 112. This number has a total of nine captives: 93, 97, 105, 110, 111, 113, 114, 116, 118.

    • isolates: this is a new term that I've introduced to describe numbers that are invariant under the odds 'n evens rule but have no captives e.g. 121.

    • vorticals: this is a made-up word that I've used to describe numbers that form part of a vortex or loop. The trajectories of some other numbers, called captives, will end up in this vortex e.g. 209 is a vortical forming part of the vortex {209, 216}. The numbers 195, 197, 199, 207, 210, 212, 214, 215, 217, 218, 220, 221, 222, 223, 224, 225, 226, 228 are all captives of this vortex.

    • captives: these numbers have trajectories that lead either to an attractor or a vortex e.g. 113 is a captive of the attractor 112 while 224 is a captive of the vortex {209, 216}.
    Below are some links to earlier posts relating to the odds 'n evens rule:

    Thursday, 28 October 2021

    An Interesting Iteration

    Having turned 26506 days old today, my attention was drawn to this OEIS sequence:


     A219960

    Numbers which do not reach zero under the repeated iteration \(x \rightarrow \lceil \sqrt{x} \, \rceil \times  (\lceil \sqrt{x}\, \rceil ^2 - x) \).


    Figure 1 shows that 26506 is the 511th such number and thus the frequency of such numbers is about 1.93%.

    Figure 1

    The first members of this sequence are as follows:
    366, 680, 691, 1026, 1136, 1298, 1323, 1417, 1464, 1583, 1604, 1702, 2079, 2125, 2222, 2223, 2374, 2507, 2604, 2627, 2821, 2844, 2897, 3152, 3157, 3159, 3183, 3210, 3231, 3459, 3697, 3715, 3762, 3802, 3866, 3888, 3936, 3948, 4004, 4111, 4133, 4145, 4231, 4299, ...
    Here is a permalink to the algorithm on SageMathCell that will return all members of OEIS A219960 up to and including 26506. 

    The OEIS comments include the following conjectures:
    • Conjecture 1: All numbers under the iteration reach 0 or, like the elements of this sequence, reach a finite loop, and none expand indefinitely to infinity. 
    • Conjecture 2: There are an infinite number of such finite loops, though there is often significant distance between them. 
    • Conjecture 3: There are an infinite number of pairs of consecutive integers in this sequence despite being less abundant than in A219303.
    OEIS A219303 refers to the iterative process where the ceiling function is replaced by the floor function. So what happens to 26506 under this iteration? Here is the trajectory:
    26506, 10269, 13770, 18172, 7155, 5950, 10452, 16171, 27264, 48472, 81549, 70642, 30324, 52675, 51750, 53352, 2079, 1702, 2604, 5200, 9417, 18326, 23120, 44217, 64144, 94488, 115808, 161293, 125022, 104076, 81719, 22022, 26671, 36900, 67357, 63180, 81648, 42328, 22248, 37800, 43875, 47250, 59732, 71785, 10452
    As can be seen, after five steps a loop of length 38 is entered with a length of 43 steps overall. Figure 2 shows this trajectory using a log scale for the vertical axis.


    Figure 2

    Up to 26506, the trajectory of maximum length is associated with the number 25923 that has a trajectory of length 86 and ends in 0:
    25923, 52002, 100531, 188574, 283185, 481832, 829135, 716046, 1154461, 1251300, 963459, 849430, 602988, 575757, 245916, 49600, 28767, 22610, 28841, 10030, 17271, 20196, 36179, 57682, 96159, 174782, 326401, 447876, 686080, 962469, 1821610, 1201500, 2094173, 3664888, 4475355, 4445716, 4565985, 1675408, 2094015, 3893672, 5929896, 10231200, 7680799, 8828820, 11781008, 15383273, 26111488, 3127320, 3610529, 6220072, 12357735, 15895836, 1327671, 2003914, 1617072, 1160064, 2177560, 1499616, 1236025, 577128, 358720, 48519, 71162, 33909, 58460, 25168, 17967, 34830, 25993, 40662, 28684, 36720, 27648, 40247, 30954, 3872, 6111, 10270, 13668, 2457, 2150, 2773, 1908, 1232, 2304, 0
    Figure 3 shows the trajectory of 25923 using a log scale for the vertical axis.


    Figure 3

    Figure 4 shows the distribution of trajectory lengths between 1 and 26506. All square numbers immediately become zero under the iteration. Using 25 as an example, we get:

    \( \lceil \sqrt{25} \rceil \times ( \lceil \sqrt{25} \, \rceil ^2 - 25) = 5 \times (25 - 25) = 5 \times 0 = 0 \)


    Figure 4

    So far only the numbers up to and including 26506 have been examined because the algorithm is processor intensive. However, if we search from 26507 to 50000, we find that the record length increases slightly to 91, again ending in 0. Here is the record length attained by 35727:
    35727, 70870, 111873, 117920, 143104, 203523, 353012, 602735, 772338, 266337, 492184, 435240, 237600, 265472, 404544, 780325, 999804, 196000, 110307, 193806, 297675, 240786, 144845, 120396, 4511, 7684, 5280, 3577, 1380, 2432, 3400, 4779, 8470, 16647, 32890, 42588, 54027, 61046, 113584, 223080, 306977, 581640, 403627, 552684, 633888, 1052837, 1943084, 211888, 291813, 469588, 691488, 612352, 577071, 402040, 752475, 823732, 664656, 979200, 891000, 128384, 178423, 214038, 153253, 161112, 197784, 107245, 111192, 121576, 78525, 122516, 240435, 317186, 513240, 608733, 959068, 1305360, 1244727, 813564, 36080, 3800, 2728, 4293, 4158, 4355, 66, 135, 108, 143, 12, 16, 0

    Here is the permalink for this calculation. Note that the penultimate number in the trajectory is 16 which is a square number (\(4^2\)), just as the penultimate number for the previous record trajectory was 2304, also a square number (\(48^2\)). Clearly, it is only when a square number is reached in the trajectory that a result of zero will arise in the next iteration. However, in the case of over 98% of numbers (at least in the range up to 26506), the trajectory does not terminate at zero but instead enters a loop.

    Conjecture 3, included earlier, states that "there are an infinite number of pairs of consecutive integers" so let's investigate this further. In the range up to 26506, the following pairs occur:

    • 2222 2223 
    • 8399 8400 
    • 11457 11458 
    • 12950 12951 
    • 19005 19006 
    • 19847 19848 
    • 22444 22445 
    • 23597 23598 
    • 25089 25090 
    • 25175 25176 
    • 25742 25743 
    So eleven pairs in that range shows that pairs of such numbers are not that common and of course there's no way to confirm that there are an infinite number of them.

    Tuesday, 24 August 2021

    Recursion involving the Divisor Function

    Interesting results arise when we consider the following iterative process involving a starting number \(n\):$$ \begin{align} n&=\frac{n}{\sigma(n,0)} \text{    if } n \equiv 0  \! \! \! \mod \sigma(n,0)\\ n&=n+\sigma(n,0) \text{    if } n \not \equiv 0 \! \! \! \mod \sigma(n,0) \end{align}$$This has the effect of quickly reducing the size of the number when it is divisible by the number of its divisors and increasing the number slightly in the case where it is not divisible before trying again.

    Let's consider what happens to the number 42 under this recursive process:

    • 42 has 8 divisors [1, 2, 3, 6, 7, 14, 21, 42]
      42 isn't divisible by 8, so 42 --> 42 + 8 = 50

    • 50 has 6 divisors [1, 2, 5, 10, 25, 50]
      50 isn't divisible by 6 so 50 --> 50 + 6 = 56

    • 56 has 8 divisors [1, 2, 4, 7, 8, 14, 28, 56]
      8 does divide into 56 to give 7

    • 7 has 2 divisors [1, 7]
      7 isn't divisible by 2 so 7 --> 7 + 2 = 9

    • 9 has 3 divisors [1, 3, 9]
      3 does divide into 9 to give 3

    • 3 has 2 divisors [1, 3]
      3 isn't divisible by 2 so 3 --> 3 + 2 = 5

    • 5 has 2 divisors [1, 5]
      5 isn't divisible by 2 and so 5 --> 5 + 2 = 7
    Thus the trajectory of 42 ends in a loop because 5 takes us back to 7. The trajectory is thus 42, 50, 56, 7, 9, 3, 5. All trajectories end in this loop as far as I can determine. In this case, the number of steps is 6 and the trajectory has 7 members when including the starting number.

    As usual, it's interesting to look for those numbers that have trajectories of record length. What I found in the range up to 30,000 was the following (SageMathCell permalink):

    1, 2, 3, 4, 6, 11, 27, 216, 224, 227, 425, 815, 1641, 13244, 19305, 19317 

    These numbers corresponded to trajectories of the following lengths:

    1, 2, 4, 5, 8, 16, 75, 77, 78, 105, 275, 282, 951, 952, 1393, 1396

    Figure 1 shows these results in tabular format. 


    Figure 1

    What's surprising is that a relatively small number like 19317 can have a trajectory length of 1396. It's interesting to look at the trajectory of this number. Figure 2 is a plot of the trajectory lengths.


    Figure 2

    Looking at Figure 2, we see how there is steady buildup until a number (27252) that is divisible by its number of divisors (18) and then there is a precipitous drop to 1514 and the same process is repeated on a smaller scale for what looks like two more times. 

    We can see the same process at work a little more clearly for 27 that has a record length of 75. See Figure 3.


    Figure 3

    Here is the full trajectory of 27 that ends in the 7, 9, 3, 5 loop:
    27, 31, 33, 37, 39, 43, 45, 51, 55, 59, 61, 63, 69, 73, 75, 81, 86, 90, 102, 110, 118, 122, 126, 138, 146, 150, 162, 172, 178, 182, 190, 198, 210, 226, 230, 238, 246, 254, 258, 266, 274, 278, 282, 290, 298, 302, 306, 318, 326, 330, 346, 350, 362, 366, 374, 382, 386, 390, 406, 414, 426, 434, 442, 450, 25, 28, 34, 38, 42, 50, 56, 7, 9, 3, 5

    Monday, 23 August 2021

    Recursion involving the Totient Function

    With plenty of time on my hands and my mind being lately obsessed with recursive processes, I contemplated what might happen if I took a number and added its totient plus one to it, repeating the process with the new number and only terminating when a prime number was reached. Put mathematically and applied to a number \(n\), we have:$$n \rightarrow n+\phi(n)+1$$The first thing to realise is that for any prime number \(p\), this process will yield:$$p \rightarrow p+\phi(p)+1=p+p-1+1=2p$$and so any prime is initially doubled by this process. Remember the totient \( \phi(n) \) of \(n\) is the number of coprime integers less than \(n\), including 1.

    Using SageMathCell, I was able to quickly determine the trajectories for all numbers up to 6000  and the distribution is shown in Figure 1. The vertical axis shows the trajectory length while the horizontal axis shows the number. Some of the record trajectories are shown in Figure 1 as well e.g. (97, 152) indicates that the number 97 sets a new trajectory record length of 152.


    Figure 1: permalink

    Below are shown the numbers that produce trajectories of record length, together with those lengths:
    •       1  has a trajectory of record length      1
    •       2  has a trajectory of record length      2
    •       3  has a trajectory of record length      8
    •     31  has a trajectory of record length     10
    •     42  has a trajectory of record length     31
    •     97  has a trajectory of record length   152
    •  1907  has a trajectory of record length   166
    •  2130  has a trajectory of record length   217
    •  3067  has a trajectory of record length   224
    •  5243  has a trajectory of record length   232
    •  7355  has a trajectory of record length   302
    •  7604  has a trajectory of record length   307
    • 10956 has a trajectory of record length >344
    SageMathCell timed out for 10956 because the composite numbers were becoming unwieldingly large. See Figure 2.


    Figure 2

    The final number is the list shown in Figure 2 is:

    128273423043384555138014803867139463949464184741011497767099217473602278 

    It was at this point that SageMathCell gave up. Presumably the trajectory of 10956 does terminate but so far I've not been able to determine its exact length, although we know it's larger than 344. The average number of iterations is slightly over 14 in the range up to 6000.

    I may have more to add on this recursive process at a later date.