How to obtain a number from a given interval?

39 Views Asked by At

I have an interval of numbers {60,72,84,90,96}

If i ask for 720 it would give me 10*72 and 5*96 + 4*60 But if i ask for 230 it gives me non existent.

The domain for the numbers are between 96 and 720.

What is the best approach for it?

Edit: I want to find all the possible solutions for the equation: 60x + 72y + 84z + 90t + 96w = N

What´s is the best approach?

1

There are 1 best solutions below

2
On BEST ANSWER

To start: since each of the numbers is divisible by $6$ there's no solution unless $N$ is divisible by $6$. Then you can simplify the problem by dividing through by $6$ and solving $$ 10x + 12y + 14z + 15t + 16w = M $$ for $M$ between $16$ and $120$.

How much you would need to learn to solve this depends on why you need the answer. If a table of values for this particular example is good enough, you could try all the possibilities since it's easy to bound the variables. $x$ must be at most $12$, and so on. That's straightforward in any programming language, probably in Excel too.

If you need something more systematic you could start here, learning about systems of linear diophantine equations: https://en.wikipedia.org/wiki/Diophantine_equation#System_of_linear_Diophantine_equations