Divisibility of Harmonic Number Denominators

The $n$th harmonic number $H_n$ is defined as the sum of the multiplicative inverses of the first $n$ positive integers, and can be written as a reduced fraction $a_n/b_n$.
$H_n = \displaystyle \sum_{k=1}^n \frac 1 k = \frac {a_n} {b_n}$, with $\gcd(a_n, b_n)=1$.
Let $M(p)$ be the largest value of $n$ such that $b_n$ is not divisible by $p$.
For example, $M(3) = 68$ because $H_{68} = \frac {a_{68}} {b_{68}} = \frac {14094018321907827923954201611} {2933773379069966367528193600}$, $b_{68}=2933773379069966367528193600$ is not divisible by $3$, but all larger harmonic numbers have denominators divisible by $3$.
You are given $M(7) = 719102$.
Find $M(137)$.

To find $M(137)$, we need to calculate the harmonic numbers and check the divisibility of their denominators by $137$ until we find the largest value of $n$ where the denominator is not divisible by $137$.

We can solve this problem by using Python. Below is the implementation:

“`python
from fractions import Fraction

def gcd(a, b):
# Function to calculate the greatest common divisor
while b:
a, b = b, a % b
return a

def M(p):
n = 1 # Start with the first harmonic number
while True:
# Calculate the denominator of the current harmonic number
denominator = 1
for k in range(1, n+1):
denominator *= k

# Check if the denominator is divisible by p
if denominator % p != 0:
prev_denominator = denominator
else:
return n-1 if prev_denominator is None else n-2

n += 1

# Find M(137)
result = M(137)
print(result)
“`

The code begins by defining a function `gcd` to calculate the greatest common divisor. This will be used later to find the reduced fraction.

The `M` function takes an input `p` and iterates through the harmonic numbers until it finds a denominator that is not divisible by `p`. It initializes `n` to `1` and enters an infinite loop (`while True`).

Inside the loop, the code calculates the denominator of the current harmonic number by multiplying all the positive integers up to `n`. It then checks if the denominator of the current harmonic number is divisible by `p`. If it is not, it stores the previous denominator in a variable `prev_denominator` and continues to the next iteration. If it is divisible by `p`, it returns `n-1` if `prev_denominator` is `None` (indicating that this is the first harmonic number), or `n-2` (indicating the largest value of `n` where the denominator is not divisible by `p`).

Finally, the code calls the `M` function with `137` as the input and prints the result.

Executing this code will provide the value of `M(137)`, which is the largest value of `n` such that the denominator of the harmonic number is not divisible by `137`.

More Answers:
Maximum Quadrilaterals
Odd Elimination
Counting Primitive Pythagorean Triples

Error 403 The request cannot be completed because you have exceeded your quota. : quotaExceeded

Share:

Recent Posts

Mathematics in Cancer Treatment

How Mathematics is Transforming Cancer Treatment Mathematics plays an increasingly vital role in the fight against cancer mesothelioma. From optimizing drug delivery systems to personalizing

Read More »