limit = 1729  
sums = {}
cnt = 0

# Generate cube sums and store in dictionary
for a in range(1, limit):
    for b in range(a, limit):
        
        #equation = a^2+(a*b)+b^2
        sum = (a**2) + (a * b) + (b**2)
        
        if(sum==limit):
            sums[cnt] = (a, b, sum)  # Store (a, b, sum) tuple with index cnt
            cnt += 1

for i in range(0,cnt):
     print(f"{sums[i]}")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: