Let
S(3)= 13+23+…+(2n)3
and
S(2)= 12+22+…+n2
For what integer values of n will the ratio r=S(3)/S(2) have an integer result?
List all existing answers.
Source: Russian Math Olympiad
fwiw, a computer run up to n=10,000 finds only the same 3 solutions found by K Sengupta:
n r
1 9.0
2 20.0
5 55.0
Note that s3(1) = 1^3 + 2^3 = 9 rather than 1
--------
def s3(n):
ans = 0
for i in range(1,2*n+1):
ans += i**3
return ans
def s2(n):
ans = 0
for i in range(1,n+1):
ans += i**2
return ans
for n in range(1,10001):
r = (s3(n)/s2(n))
if r%1 == 0:
print(n,r)
|
Posted by Larry
on 2022-05-19 09:23:26 |