Each of x and y is a positive integer that satisfies this equation:
x
oC=y
oF
Determine the minimum value of x+y such that:
x is a triangular number and, y is a
heptagonal pyramidal number.
What is the next smallest value of x+y?
***
oF = (9/5)*
oC+32, where
oF represents degree Fahrenheit and,
oC represents degree Celsius.
sum X Y
1796 = 630 + 1166
2328 = 820 + 1508
630 is the 35th triangular number
1166 is the 11th heptagonal pyramidal number
820 is the 40th triangular number
1508 is the 12th heptagonal pyramidal number
I believe these are the only solutions having checked up to the 10^8-th triangular number.
-------------
def heptPyr(n):
""" return the n-th heptagonal pyramidal number.
see oeis A002413 """
return int(n*(n+1)*(5*n-2)/6)
def isHeptPyr(n):
""" bool: True if n is a heptagonal pyramidal number.
see oeis A002413 """
x = int(n ** (1/3))
y = [heptPyr(x),heptPyr(x+1)]
return n in y
def istri(n):
""" check if integer n is a triangular number """
if ((1 + (1+8*n)**.5)/2) % 1 == 0:
return True
else:
return False
def c2f(n):
""" Convert Celsius to Fahrenheit """
if (n*9/5 + 32)%1 == 0:
return int(n*9/5 + 32)
else:
return n*9/5 + 32
def f2c(n):
""" Convert Fahrenheit to Celsius """
if ((n-32)*5/9)%1 == 0:
return int((n-32)*5/9)
else:
return (n-32)*5/9
print('sum X Y')
for i in range(0,100000000,5):
aTri = int((i+1)*i/2)
fahrTri = c2f(aTri)
if isHeptPyr(fahrTri):
print(aTri+fahrTri, '=',aTri,'+',fahrTri)
|
Posted by Larry
on 2022-12-22 10:29:14 |