Showing posts with label harmonic mean. Show all posts
Showing posts with label harmonic mean. Show all posts

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\): $$ \frac{n}{\sigma(n)/ \tau(n)} = \frac{n \times \tau(n)}{\sigma(n)} \text{ is an integer}$$Harmonic 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<10^{24}\) and if true, it will imply that no odd perfect numbers exist. Jaycob Coleman has observed that all the Ore numbers up to \(10^{14}\) 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 \(10^{14}\).

In the case of the number (27846) associated with my diurnal age, we have:$$ \begin{align} \tau(27846) &= 48 \\ \sigma(27846) &= 78624\\ \frac{27846 \times 48}{78624} &= 17 \end{align}$$

Wednesday, 29 May 2024

The Harmonic Mean

I keep coming across a certain type of problem and so I gave Google's Gemini the opportunity to explain the solution. What follows is our interaction.

Here is a problem. 

A worker A can complete a task in 50 minutes and another worker B can complete the same task in 40 minutes. If they work together, how long will it take them to complete the task. 

Can you explain how the answer is reached?

Absolutely! Here's how we can find how long it takes workers A and B to complete the task together:

1. Rate of Each Worker:

Instead of focusing on the complete time each worker takes, we can think about their rates of completing the task.

Worker A's rate: We can say A completes 1/50th of the task every minute (since they take 50 minutes to do the whole thing).

Worker B's rate: Similarly, B completes 1/40th of the task every minute.

2. Combined Rate:

When A and B work together, they essentially combine their rates. So, their combined rate is the sum of their individual rates:

Combined Rate = Rate of A + Rate of B

Combined Rate = \( \dfrac{1}{50} + \dfrac{1}{40} \)

3. Finding the Combined Time:

Imagine the combined rate represents how much of the task they complete every minute when working together. Since they combine their efforts, they'll finish the entire task (which is 1 unit of work) when the combined rate reaches 1.

Therefore:

Time taken to complete the task together:

$$ \begin{align} x &= \frac{\text{Total work (1)}}{\text{ Combined Rate} }\\ &= \frac{1}{ \dfrac{1}{50} + \dfrac{1}{40}} \end{align}$$

4. Simplifying the Math:

To simplify the above equation, we can find a common denominator for the fractions (which is the least common multiple of 50 and 40, which is 200):

$$ \begin{align} x &= \frac{1}{ \dfrac{1}{50} + \dfrac{1}{40}} \\ &= \frac{1}{\dfrac{9}{200}} \end{align}$$

5. Final Answer:

Inverting the fraction gives us the total time: $$ \begin{align} x &= \frac{200}{9} \\ &= 22 \frac{2}{9} \text{ minutes (approximately)} \end{align} $$

Explanation:

By combining their rates, we essentially calculate how much faster they complete the task together compared to working individually. This combined rate helps us determine the total time it takes for them to finish the entire task.

Has this got anything to do with means, such as the harmonic mean or the geometric mean?

You've got a good eye! In this specific case, the method we used to find the time to complete the task together is closely related to the harmonic mean.

Here's why:

The harmonic mean is ideal for finding the average rate when rates are involved.

In this problem, we weren't finding the average time to complete the task, but the average rate at which they work together (which is the reciprocal of the average time).

Mathematically, the harmonic mean of two numbers a and b is:

harmonic mean = \( \dfrac{2 a  b}{  a + b} \)

While we didn't use this exact formula, the underlying principle is the same. We took the individual rates (1/50 and 1/40), essentially representing how much of the task they complete per minute, and combined them proportionally using a common denominator. This combined rate represents the average rate at which they work together, which is what the harmonic mean helps us find.

The geometric mean, on the other hand, wouldn't be applicable here. It's used for finding the average of multiplied quantities, which isn't the case in this scenario.

Saturday, 30 October 2021

Reciprocals of Primes

I came across an interesting video on YouTube by Michael Penn in which he investigates an interesting property of prime numbers, namely that if \(p\) is an odd prime, then:$$\frac{2}{p}=\frac{1}{m}+\frac{1}{n} \text{ where } m>n \geq 1 \text{ and } m,n \in \mathbb{Z}$$Furthermore, this representation is unique. The proof is simple enough and yet quite elegant. Here it is:$$\begin{align} \frac{2}{p}&=\frac{1}{m}+\frac{1}{n}\\2mn&=np+mp\\2mn-np-mp&=0\\4mn-2np-2mp&=0\\4mn-2np-2mp+p^2&=0+p^2\\(2m-p)(2n-p)&=p^2 \end{align}$$This is the crucial point. \(p^2\) factorises to either \(p \times p\) or \(p^2 \times 1\). However, because \(m>n\), then \(2m-p>2n-p\) and so we need to look at the factors of \(p^2\) and \(1\). So, because \(p^2>1\), we have:$$ \begin{align} 2m-p &= p^2 \text{  and  } 2n-p=1\\ m &= \frac{p(p+1)}{2} \text{  and  } n=\frac{p+1}{2} \end{align}$$The \(p \times p\) factorisation leads to the trivial case, where \(m=n=p\). Figure 1 shows the results for the odd primes up to 97.


Figure 1

Thus we can write \( \dfrac{2}{97}=\dfrac{1}{4753}+\dfrac{1}{49} \). If a composite number is entered into the above calculations, there will be more than one representation. For example, in the case of 25, we can write:$$\frac{2}{25}=\frac{1}{75}+\frac{1}{15}=\frac{1}{325}+\frac{1}{13}$$The reason is that the possible factorisations are no longer just \(p \times p \) and \(p^2 \times 1 \). In the case of 25, we now have 625 x 1 as well as 125 x 5 and of course the trivial 25 x 25. Hence the two solutions shown above. Here is the embedded video:



It was only when reading some of the comments to this video that I came across a connection with the harmonic mean. For two numbers, \(m\) and \(n\), the harmonic mean is defined to be \( \frac{2mn}{m+n} \). If we go back to our original expression, we see that:$$ \begin{align} \frac{2}{p}&=\frac{1}{m}+\frac{1}{n}\\ \\ \frac{2}{p}&=\frac{m+n}{mn}\\ \\ \frac{p}{2}&=\frac{mn}{m+n}\\ \\ p&=\frac{2mn}{m+n} \end{align}$$So \(p\) represents the harmonic mean of the numbers \(m\) and \(n\). For example, the harmonic mean of 49 and 4753 is 97 (referring back to Figure 1). The harmonic mean is one of the Pythagorean means, the other two being the arithmetic mean and the geometric mean. I did mention these means briefly in a post from 13th September 2020 titled Root-Mean-Square and Other Means but I should investigate this topic in more detail.

Saturday, 12 September 2020

Root-Mean-Square And Other Means

Today I turned 26095 days old and this number happens to be a so-called RMS number where RMS stands for Root-Mean-Square. Such numbers are defined by OEIS A140480 as numbers \(n\) such that root mean square of divisors of \(n\) is an integer. Now the root mean square of divisors is defined by MathWorld as:

For a set of \(n\) numbers or values of a discrete distribution \(x_i, ..., x_n\), the root-mean-square (abbreviated "RMS" and sometimes called the quadratic mean), is the square root of mean of the values \(x_i^2\), namely:$$x_{RMS}=\sqrt{\frac{x_1^2+x_2^2+...+x_n^2}{n}}=\sqrt{\dfrac{\sum \limits_{i=1}^n x_i^2}{n}}$$For a variate \(\chi\) from a continuous distribution \(P(x)\), we have:$$x_{RMS}=\sqrt{ \frac{\int[P(x)]^2 dx}{\int P(x) \,dx}}$$where the integrals are taken over the domain of the distribution. Similarly, for a function \(f(t)\) periodic over the interval \([T_1,T_2]\), the root-mean-square is defined as:$$f_{RMS}=\sqrt{\frac{1}{T_2-T_1}\int_{T_1}^{T_2} [f(t)]^2 dt}$$

The sequence to which 26095 belongs runs 1, 7, 41, 239, 287, 1673, 3055, 6665, 9545, 9799, 9855, 21385, 26095, ... with 7, 41 and 239 being prime and the next prime being 9369319. Such primes are known as NSW primes, after Newman, Shanks, and Williams (the authors of a paper on the subject back in 1981). If we designate \(n\) to be such a prime number, then \(n\) has 2 divisors \([1, n]\) and we have to solve Pell's equation \(n^2 = 2*C^2 - 1\) where \(C\) is a positive integer. The solution is a prime \(n\) of the form \(u_i = 6u_{i-1} - u_{i-2} \), where \(i \geq 2, u_0=1, u_1=7\). These primes are listed in OEIS A088165.

There are of course many other types of means including arithmetic, geometric, harmonic, Pythagorean, power, Heronian, Identric, population, Chisini, Stolarsky, Lehmer, weighted and so on. The arithmetic mean is certainly the best known and most widely used but the root-mean-square has many applications in scientific circles. I've encountered the root-mean-square before in the context of the root-mean-square-error (see Figure 1).


Figure 1

A regression line is a line drawn such that the RMSE is minimised (see Figure 2).

Figure 2

The root-mean-square is a particular instance of a more generalised power mean defined as:$$M_p(a_1, a_2, ..., a_n) \equiv \bigg( \frac{1}{n} \sum_{k=1}^n a_k^{\,p} \bigg)^{1/p} $$where the parameter \(p\) is an affinely extended real number and all \(a_k \geq 0\). A power mean is also known as a generalized mean, Hölder mean, or mean of degree (or order or power) \(p\). The case of \(p=1\) is the arithmetic mean and the case of \(p=2\) is the root-mean-square. 

Figure 3 shows a summary of a few particular values of \(p\) that yield special cases with their own names (source):

Figure 3

The three "classic" means \(A\) (the arithmetic mean), \(G\) (the geometric mean), and \(H\) (the harmonic mean) are sometimes known as the Pythagorean means. Figure 4 shows how these means on two elements \(a\) and \(b\) could be constructed geometrically, and also demonstrates that \(H \leq G \leq A\).


Figure 4: source