Question: Write a python script to find all the combinations of three integers i, j, k that gives i^3 + j^3 + k^3 = N, where
Write a python script to find all the combinations of three integers i, j, k that gives i^3 + j^3 + k^3 = N, where N goes from 45 to 95 and i, j, and k go from -1000 to 1000 respectively. Save running time, you can store the cubed values in a dictionary (which is a hash table) with numbers as the keys, i.e., {, 1: 1, 2: 8, 3: 27, , }. In this way, you dont need to repeatedly compute the cubed values. You also can use another dictionary to store the inverse relationship, i.e., {, 1:1, 8:1, 27:3, ..}. In this way, you dont need the loop for the value k. Your output should look like: N = 50 N = 51 -796 602 659 -796 659 602 602 -796 659 602 659 -796 659 -796 602 659 602 -796 N = 52 N = 53 -240 80 237 ....
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
