kyrpav kyrpav - 26 days ago 10
Python Question

finding if a number is a common multiples of some other numbers

I want to write a program that calculates if a number is a multiple of some other numbers.
Lets say that i want to check if 25 can be given from a function like 2a+3b+4c=25.Is there any algorithm that can find a b c in order to check if abc are integers?

Answer Source

For generating all possibilities, a Brute force algorithm will suffice:

Loop over all possible values for a and subtract the sum 2a from 25. Nest similar loops for b using the remainder. If the remainder after subtracting 3b is a multiple of 4, then loop over all possible values of c and output a, b, and c as a combination.