Homepage Solution manuals Ivan Niven An Introduction to the Theory of Numbers Exercise 3.6.2 (Maximum value of $R(n)$ for positive $n \leq 1000$)

Exercise 3.6.2 (Maximum value of $R(n)$ for positive $n \leq 1000$)

What is the maximum value of R ( n ) for positive n 1000 ?

Answers

Proof. Note that R ( 325 ) = R ( 5 2 13 ) = 4 3 2 = 24 . Here 5 and 13 are the smallest primes of the form 4 k + 1 . If we want to improve this score, we must increase the exponent of 5 or 13 , but 5 3 13 > 1000 and a fortiori 5 2 1 3 2 > 1000 .

Thus the maximum value of R ( n ) for positive n 1000 if 24 . □

Check:

def R(n):
    prod = 1
    decomposition = True
    for p, alpha in factor(n):
        if (p % 4 == 3) and (alpha % 2 == 1):
            decomposition = False
            break
        if p % 4 == 1:
            prod  = prod * (alpha + 1)
    if decomposition:
        return 4 * prod
    else:
         return 0

nrec, maxi = 0, 0
for n in range(1,1001):
    rec = R(n)
    if rec > maxi:
        nrec = n
        maxi = rec
print(nrec, maxi)

       
(325, 24)

User profile picture
2024-11-27 10:06
Comments