kyrpav - 5 months ago 25

Python Question

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?

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

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.

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**