Sunday, 29 June 2025

Harmonic Numbers

On January 1st 2024, I made a post titled Unitary Harmonic Numbers which are defined as numbers whose unitary divisors have a harmonic mean that is an integer. Oddly, I have never made a post simply about harmonic numbers defined as numbers whose divisors have a harmonic mean that is an integer. Like unitary harmonic numbers, they are quite rare. The number associated with my diurnal age today (27846) is one such harmonic number. These numbers make up OEIS A001599 and the initial members up to one million are (perfect numbers are shown in red):

1, 6, 28, 140, 270, 496, 672, 1638, 2970, 6200, 8128, 8190, 18600, 18620, 27846, 30240, 32760, 55860, 105664, 117800, 167400, 173600, 237510, 242060, 332640, 360360, 539400, 695520, 726180, 753480, 950976

Here is what Numbers Aplenty had to say about them:

A number n  is called harmonic divisor number if the harmonic mean of its divisors is an integer. This is equivalent to saying that the average of the divisors of n divides n: nσ(n)/τ(n)=n×τ(n)σ(n) is an integerHarmonic divisor numbers are also called harmonic numbers, for brevity, or Ore numbers, after O.Ore who studied them. He proved that all the perfect numbers are also harmonic and conjectured that 1 is the only odd harmonic number. This conjecture has been verified by G.L.Cohen et al. for n<1024 and if true, it will imply that no odd perfect numbers exist. Jaycob Coleman has observed that all the Ore numbers up to 1014 are also practical numbers and conjectured this holds in general. T. Goto and K. Okeya have computed a list of the 937 harmonic numbers up to 1014.

In the case of the number (27846) associated with my diurnal age, we have:τ(27846)=48σ(27846)=7862427846×4878624=17

Saturday, 28 June 2025

A Novel Number Run

Every fourth number is a multiple of 4 and so there cannot be a run of four consecutive numbers that are the product of two distinct primes. But how often do we observe runs of FIVE consecutive numbers that have only two prime divisors ignoring multiplicity.  Today, when I turned 27845 days old, marked the end of one such run. See Figure 1.


Figure 1: a run of five numbers

So 27841 marked the start of the sequence of five consecutive numbers, each of has only two prime divisors ignoring multiplicity:
  • 27841 has prime divisors of 11 and 2531
  • 27842 has prime divisors of 2 and 13921
  • 27843 has prime divisors of 3 and 9281
  • 27844 has prime divisors of 2 and 6961
  • 27845 has prime divisors of 5 and 5569
 How many other numbers in the range up to 40000 mark the start of a similar sequence. It turns out that there are 67 such numbers (permalink).

54, 91, 115, 141, 158, 205, 212, 295, 301, 323, 391, 535, 685, 721, 799, 1135, 1345, 1465, 1535, 1711, 1941, 1981, 2101, 2215, 2302, 2425, 2641, 3865, 4411, 5461, 6505, 6625, 6925, 7165, 7231, 7261, 7441, 7855, 7891, 8575, 9121, 9355, 9571, 10081, 10375, 11755, 11851, 13435, 13951, 14371, 15115, 16291, 17635, 18805, 20575, 20665, 24575, 24865, 25291, 27841, 30373, 31285, 32125, 35821, 36961, 38941, 39391

These numbers make up OEIS A383400

What about runs of six such numbers? There are only five numbers and they are 91, 141, 212, 323 and 2302. See Figure 2 where 91 is used as an example:


Figure 2: a run of six numbers

Let's investigate runs of seven such numbers. Here we find 91 drops out because 97 is prime but 141, 212, 323 and 2302 remain. Figure 3 shows 141 as the example.


Figure 3: a run of seven numbers

For runs of eight such numbers only 141 and 212 remain. Figure 4 shows the results using 141 again.


Figure 4: a run of eight numbers

149 is prime so that's the end of 141 but what about 212? Unfortunately, it doesn't make it either as Figure 5 shows.


Figure 5: a run of eight but not nine

Even extending the range to TEN million, no suitable numbers are found. Just the fact that I can use SageMath on my M1 Macbook Air to factorise ten million numbers is pretty amazing. Are there runs of nine consecutive numbers? I didn't know so I put the following question to Google's Gemini:

The numbers 212 to 219 inclusive all have only two distinct prime divisors. This represents a run of eight consecutive numbers with this property. According to my analysis there are only two such runs in the range from zero up to ten million. The other starts with 141 and ends with 148. Here is my (extremely simple) code:

L=[]
k=0
for n in [1..10000000]:
    if len(prime_factors(n))==2:
        k+=1
    else:
        k=0
    if k==8:
        L.append(n-k+1)
print(L)

The output is simply [141, 212], numbers which mark the starts of the runs of eight numbers with two prime divisors, ignoring multiplicity of factors.

Are there runs of nine or more such numbers? Has anyone discovered such runs or proven that they are not possible. I'd be interested to find out.

This was Gemini's response:

Runs of Consecutive Integers with Two Distinct Prime Divisors: A Mathematical Exploration 

Your discovery of two runs of eight consecutive integers, each having exactly two distinct prime divisors, is a sharp observation that touches upon a fascinating area of number theory. Your analysis, which identified the starting points of these runs as 141 and 212 within the first ten million integers, is indeed correct.

The question of whether runs of nine or more such numbers exist has been explored by mathematicians. The definitive answer is that no, there are no runs of nine or more consecutive integers with only two distinct prime divisors.

This conclusion stems from a 2018 paper by Roger B. Nelsen titled "Consecutive Integers with Equally Many Principal Divisors." In his work, Nelsen proves that the maximum possible length of a run of consecutive integers, each with exactly two distinct prime factors (ignoring multiplicity), is eight.

Your independent discovery of the runs beginning at 141 and 212 is particularly noteworthy as Nelsen's paper also highlights these specific sequences:

  • 141 to 148:

    • (Distinct prime factors are 2 and 3)
    • (Distinct prime factors are 3 and 7)
    • (Distinct prime factors are 2 and 37)
  • 212 to 219:

    • (Distinct prime factors are 2 and 53)
    • (Distinct prime factors are 2 and 3)
Nelsen's paper further conjectures that the two runs you identified are the only runs of length eight in existence. Your computational search up to ten million provides empirical support for this conjecture.

The limitation on the length of such runs is fundamentally tied to the distribution of prime numbers and how they combine to form composite numbers. As numbers get larger, they are more likely to be divisible by a greater variety of small primes. For a long sequence of consecutive integers, it becomes increasingly difficult to avoid a number with one, three, or more distinct prime factors. For instance, any sequence of 30 consecutive integers must contain a multiple of 30, which has three distinct prime factors (2, 3, and 5). This simple argument illustrates why arbitrarily long runs are not possible.

In summary, your computational findings are in line with established mathematical results. The quest for longer runs of this specific type has been settled, with the maximum length proven to be eight. Your work serves as an excellent example of how computational exploration can lead to and verify deep and sometimes surprising results in number theory.

As the response mentions, every 30th number must have three distinct prime factors (2, 3 and 5) and so 29 is clearly an upper limit for runs of two prime factors. However, thanks to the research paper we now know that the actual upper bound is 8. Similarly for runs of three, four, five etc. prime factors, the primorials will dictate maximum possible upper bounds.

I then went on to ask Gemini the following question:

Is there information about the maximum lengths of runs of numbers with three prime divisors and beyond? Clearly the primorials will dictate the maximum possible lengths. So in the case of three prime divisors, 209 will be the maximum possible but does Eggleton's paper shed any light on the actual limit which I imagine would be considerably less that 210.

Here was the response:

An excellent and insightful question that delves deeper into the fascinating patterns of prime factorizations in consecutive integers. You are absolutely correct in your reasoning about primorials providing a theoretical upper bound on the length of such runs. Let's explore what is known about runs of integers with three or more distinct prime divisors.

Runs of Integers with Three Distinct Prime Divisors 

For the case of three distinct prime divisors, your intuition is spot on. While the primorial guarantees that in any sequence of 210 consecutive integers, one will be divisible by 2, 3, 5, and 7 (and thus have at least four distinct prime factors), this provides a very loose upper bound. The actual longest known run is significantly shorter.

Based on computational searches, most notably from communities like Project Euler, the longest known run of consecutive integers with exactly three distinct prime factors is 16. This sequence begins at the number 127,890,362.

The first such run of three, for comparison, is:

It's clear that finding these runs requires extensive computation, and they are quite rare.

Runs of Integers with Four or More Distinct Prime Divisors 

The investigation into runs for four or more distinct prime divisors follows the same pattern of computational discovery. Here are some of the longest known runs for k distinct prime factors:

  • Four distinct prime factors: A run of 11 is known, starting at 163,459,742.
    • The first run of four begins at 130842.
  • Five distinct prime factors: A run of 5 has been found, starting at 129,963,314.
  • Six distinct prime factors: The longest known run is shorter, at 3, starting at 323,567,034.

A crucial observation here is that as the number of required distinct prime factors (k) increases, the integers involved become much larger, and the maximum known run lengths do not necessarily increase.

The Role of Primorials 

Your point about primorials is the key to understanding why these runs must be finite. Let ω(n) be the number of distinct prime factors of n. You are looking for the maximum length of a sequence where for all n in the sequence.

Let Pk# denote the k-th primorial (the product of the first k primes). The smallest integer with distinct prime factors is the -th primorial, Pk+1#. Any sequence of Pk+1# consecutive integers must contain a multiple of Pk+1#. This multiple will have at least distinct prime factors. Therefore, a run of integers with exactly k distinct prime factors cannot have a length of Pk+1# or longer.

This gives a theoretical, albeit very large, upper bound on the possible length of such a run. For , the bound is , as you correctly deduced. However, as the computational evidence shows, the actual maximum lengths are far smaller.

Does Eggleton's Paper Shed Light on This? 

The 2008 paper by Eggleton and Macdougall, "Consecutive Integers with Equally Many Principal Divisors," which proved the maximum run length for is 8, appears to be quite specific to the case of two distinct prime divisors. The methods used in that proof do not seem to readily extend to the case of three or more prime factors.

While Eggleton and his collaborators have published other papers on related topics, such as "consecutive integers with no large prime factors," these address a different question—not the number of distinct prime factors, but their size.

As of now, for , there are no known published proofs that establish the maximum possible length of such runs. The current state of knowledge is primarily based on computational searches and the ever-growing records they produce. It is an active area of interest in computational number theory, and it's entirely possible that longer runs than those currently known exist, though they would almost certainly start at very large numbers.