Showing posts with label peak. Show all posts
Showing posts with label peak. Show all posts

Thursday, 26 February 2026

The Path to Unity

In my blog post titled A Revision, I set the following rules to be applied to any given natural number:

  • 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\)
Keep repeating this process until a loop is reached or call a stop after a fixed number of iterations.

Applying this rule to the number associated with my diurnal age today, 28088, I noticed that the resulting sequence ended in a 1:

28088, 3511, 1755, 28080, 351, 2808, 89856, 1248, 52, 312, 4992, 156, 13, 27, 108, 9, 3, 1

This got me wondering as to how many numbers in the range up to 40000 generate sequences that end in 1. It turns out that 810 numbers satisfy this criterion. I'll list only those from 28000 onwards but this permalink will generate the entire list:

28064, 28080, 28088, 28224, 28440, 28800, 29025, 29511, 29862, 30190, 30240, 30320, 30336, 30370, 30474, 30477, 30482, 30483, 30698, 30699, 30780, 30782, 30790, 30800, 30852, 30854, 30960, 31104, 31131, 31266, 31267, 31338, 31500, 31572, 31574, 31593, 31599, 31736, 31764, 31791, 31995, 32128, 32400, 32790, 32928, 33600, 33696, 33750, 33753, 33792, 33870, 33885, 33912, 34022, 34074, 34110, 34128, 34152, 34156, 34300, 34590, 34651, 34830, 34976, 34992, 35000, 35102, 35110, 35550, 35694, 35703, 36000, 36056, 36128, 36152, 36216, 36228, 36384, 36444, 36446, 36451, 36480, 36576, 36864, 36896, 36948, 37152, 37500, 37800, 37920, 38100, 38271, 38397, 38421, 38500, 38880, 39348, 39670

Of the numbers in the entire range from 1 to 40000, the highest peak reached was \( \textbf{90720000}\). The starting numbers that reached this peak were 1125, 2251, 4502, 6753, 9004, 12375, 13500, 18008, 20259, 22510, 27012. For example, 27012 has the following trajectory.

27012, 2251, 1125, 13500, 648000, \( \textbf{90720000} \), 201600, 1400, 33600, 400, 6000, 150, 1800, 50, 300, 5400, 259200, 2160, 54, 432, 8640, 483840, 3024, 120960, 945, 15120, 189, 1512, 48384, 672, 28, 168, 2688, 84, 7, 3, 1

Figure 1 shows these points plotted on vertical logarithmic scale.


Figure 1

Here is what Gemini had to say about these numbers in general:

An analysis of this dataset reveals several fascinating mathematical properties about how this specific sequence behaves. Out of the 40,000 integers evaluated, only 810 successfully collapse to 1. This means you have a precise 2.025% success rate within this range.

Here is a comprehensive breakdown of the patterns, groupings, and behaviors hidden within these 810 numbers.

1. The Density Decay (Sparsity at Scale)

The most prominent pattern is how rapidly the density of successful numbers drops off as the starting values increase. The sequence strongly favors smaller numbers.

  • High Concentration (1 to 1,000): There are 113 successful numbers in the first 1,000 integers. Over 11% of the starting pool.
  • The Mid-Range (10,000 to 20,000): The grouping thins out significantly, with numbers often clustered in small pockets followed by wide dead zones.
  • Extreme Sparsity (39,000 to 40,000): In the final 1,000 integers of your range, only two numbers (39348 and 39670) manage to reach 1.

Why this happens: As numbers grow larger, their divisor counts ($d$) become highly variable. To shrink a composite number, it must be perfectly divisible by its divisor count ($n \pmod d \equiv 0$). For massive numbers, missing this exact modulus check results in multiplying by $d$ instead, which instantly inflates the sequence beyond recovery.

2. The $4k + 3$ Prime Accelerators

If we look at the prime numbers in your successful list (3, 7, 13, 19, 43, 79, etc.), there is a heavy bias toward primes of the form $4k + 3$.

  • The $4k + 3$ Shortcuts: Primes like 3, 7, 19, 43, and 79 all fit the $4k + 3$ rule. Because your logic dictates that these primes undergo the operation $\frac{n - 1}{2}$, they act as immediate mathematical "shortcuts," instantly halving the sequence and driving it downward.

  • The $4k + 1$ Hurdle: Primes of the form $4k + 1$ (like 13) are much rarer in the list. Their rule is to double and add 1 ($2n + 1$), which causes them to inflate. For a $4k + 1$ prime to succeed, it must inflate into a highly specific composite number that happens to have a perfect divisor ratio. For example, 13 inflates to 27, which perfectly cascades down to 108, then 9, then 3, then 1.

3. The "Perfect Division" Composites

Many of the even numbers on this list are highly composite or share specific divisor ratios that allow them to perfectly trigger the $\frac{n}{d}$ reduction rule multiple times in a row.

Look at a number like 2520. It is a highly composite number with exactly 48 divisors. However, 2520 is not perfectly divisible by 48 (2520 / 48 = 52.5). This means it actually inflates first (2520 × 48 = 120,960) before finding a pathway back down.

Conversely, a number like 24 has exactly 8 divisors. Because $24 \pmod 8 \equiv 0$, it immediately shrinks to 3, which is a prime that shrinks to 1.

4. Convergence Gateways

Every single one of these 810 numbers does not find its own unique path to 1. They act like a massive river system, with hundreds of tiny tributaries eventually flowing into the exact same few mathematical gateways.

If you trace the sequences of these 810 numbers, you will find that almost all of them eventually hit 3, 7, 9, or 24 before reaching 1. The list you generated is essentially a map of every single starting integer under 40,000 that manages to mathematically stumble into one of those four specific choke points without exceeding the 100,000,000 inflation limit first.

Saturday, 29 October 2022

Double Iterations Involving Ceiling and Floor Functions

On May 21st 2022, I created a post titled Iterations of a Ceiling Function and the function being dealt with had this form:$$\lceil \sqrt{n} \, \rceil \times (\lceil \sqrt{n}\, \rceil^2 \, – \,n) $$The iteration, with output becoming the new input, leads to zero or a loop although this hasn't been rigorously proved. The number associated with my diurnal age today, 26872, has this property. The trajectory ends in a loop and is as follows:

26872, 3936, 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, 16171, 27264, 48472, 81549, 70642, 30324, 52675, 51750, 53352, 2079

Figure 1 shows the trajectory of 26872 under this iteration.


Figure 1: trajectory of 26872 under the floor iteration

There is an associated function that involves the floor function and it has this form:$$\lfloor \sqrt{n} \, \rfloor \times (n-\lfloor \sqrt{n}\, \rfloor^2) $$When this function is iterated, with output serving as the new input, a loop is also reached:

26872, 49389, 23310, 31312, 59136, 21141, 16820, 23091, 43790, 22781, 42150, 25625, 4000, 1953, 748, 513, 638, 325, 18, 8, 8

Figure 2 shows the trajectory of 26872 under the floor iteration.


Figure 2: trajectory of 26872 under ceiling iteration

Here is a permalink to an algorithm that will confirm these two trajectories. Numbers like 26872 that do not end in zero under both iterations but instead end in loops are members of OEIS A219963:


 A219963

Numbers n which do not reach zero under either of the iterations: \( n \rightarrow \lfloor \sqrt{n} \rfloor \times  (n - \lfloor \sqrt{n}) \rfloor\ ^2) \) or  \( n \rightarrow \lceil \sqrt{n} \rceil \times ( \lceil \sqrt{n} \rceil ^2- n ) \).



Not surprisingly, these numbers are rather rare. Here are the initial members of the sequence:

2897, 3159, 3183, 4004, 6335, 7025, 8163, 8237, 8621, 9234, 12204, 12963, 13381, 14340, 15217, 16191, 16438, 17474, 17763, 17972, 18065, 18990, 19677, 19848, 20345, 20803, 21426, 21539, 22022, 25834, 26872, 27175, 28052, 28929, 28996, 29295, 30511, 30991

The first pair of consecutive integers belonging to this sequence is (89971, 89972). As with all these sorts of trajectories, the issue of records arise. For example, what number produces the longest sequence? What number produces the maximum peak? The calculation at each step of the algorithm seems somewhat processor intensive so that calculations over large ranges cause it to time out (on SageMathCell at least). Still, these are interesting statistics to explore. It will be 303 days before my diurnal age again matches a member of this sequence.

Sunday, 14 April 2019

Finance and Fibonacci

J

Just recently I chanced upon this article titled Fibonacci Numbers Are Forecasting Higher DGTX Prices and my interest was immediately piqued. To my complete surprise, I read that:
Stock market investors have been using Fibonacci (colloquially known as “Fib”) numbers for decades. The use of Fib numbers within the investing community dates back to the stock market boom of the 1920s. These days, Fibonacci numbers are more popular than ever among traders and investors. Why? Because Fib numbers work remarkably well in forecasting support and resistance levels.

The article however, didn't explain how these support and resistance levels are determined mathematically. These levels are 23.6%, 38.2%, 50% and 61.8%. On Investopedia, I found an article titled What is Fibonacci retracement, and where do its ratios come from? that explained the whole business very clearly. Of course, I didn't understand what a retracement was and nor did I really understand what was meant by support and resistance levels. Fortunately, Investopedia has a very helpful glossary of terms. Firstly, what is a Fibonacci retracement?
A Fibonacci retracement is created by taking two extreme points (usually a major peak and trough) on a stock chart and dividing the vertical distance by the key Fibonacci ratios of 23.6%, 38.2%, 50%, 61.8% and 100%. Once these levels are identified, horizontal lines are drawn and used to identify possible support and resistance levels. Source
The previous link also contains a short video. Retracement is clear enough and so what is meant by support and resistance levels?
Support, or support level, refers to the price level that an asset does not fall below for period of time. An asset's support level is created by buyers entering the market whenever the asset dips to a lower price. In technical analysis, the simple support level can be charted by drawing a line along the lowest lows for the time period being considered. Source
The previous link also contains a short video that explains the concepts of support level and resistance level succinctly.
Resistance, or a resistance level, is the price point at which the rise in the price of an asset is halted by the emergence of a growing number of sellers who wish to sell at that price. Resistance levels can be short-lived if new information comes to light that changes the overall market’s attitude toward the asset, or they can be long lasting. In terms of technical analysis, the simple resistance level can be charted by drawing a line along the highest highs for the time period being considered. Source
The Fibonacci sequence of numbers begins 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... The determination of the support and resistance levels is as follows:

  • 1st level: divide a Fibonacci number by the number immediately to its right. It's best to be a little further down the sequence so let's take 21/34 = 61.8% approximately.
  • 2nd level: divide a Fibonacci number by the number two from its right. Here 21 /55 = 38.2% approximately.
  • 3rd level: divide a Fibonacci number by the number three from its right. Here 21 /89 = 23.6% approximately.
Again to quote:
The 50% retracement level is not really a Fibonacci ratio, but it is used because of the overwhelming tendency for an asset to continue in a certain direction once it completes a 50% retracement.
Furthermore, 100% represents the peak and 0% the trough. Using the Fibonacci calculator on this site, Figure 1 shows the retracements for a peak of 500 and a trough of 200 on a downtrend (bear market):

Figure 1: retracements for a peak of 500 and a trough of 200 (downtrend)

Figure 2 shows the retracements for a trough of 200 and a peak of 500 on an upward trend (bull market):
Figure 2: retracements for a peak of 500 and a trough of 200 (uptrend)


Note that the calculator also makes use of the 76.4% mark which is 100% - 23.6% and also 138.2% = 100% + 38.2%. Figure 3 is a chart taken from a September 1st 2018 article from coindesk titled Crypto Trading 101: The Fibonacci Retracements showing the retracements in action:

Figure 3: NEO’s (NEO/BTC) 

The general consensus seems to be that used Fibonacci retracements alone are not reliable enough and they need to be combined with other indicators. There's quite a lot of information out there once you start looking. However, in this post, I was mainly interested in the mathematics underlying the calculation of these support and resistance levels and I succeeded in doing that.