import pandas as pd
- Equation to solve: 4x + 1.5y + 16z = 480
- The task is to find all integer positive solutions for x, y, z
solutions = []
- Looping over potential integer values of x, y, z to find solutions
for x in range(1, 121): # since 4x <= 480, x_max = 120
for y in range(1, 321): # since 1.5y <= 480, y_max = 320
for z in range(1, 31): # since 16z <= 480, z_max = 30
if 4 * x + 1.5 * y + 16 * z == 480:
solutions.append([x, y, z])
- Create a DataFrame to store the solutions
df = pd.DataFrame(solutions, columns=['x', 'y', 'z'])
- Save the DataFrame to an ODS file
file_path = "/mnt/data/solutions.ods"
df.to_excel(file_path, engine='odf', index=False)
file_path # Return the path of the created file