### Brute Force Double Equation Solver

A man buys 3 fish and 2 chips for £2.80
A woman buys 1 fish and 4 chips for £2.60
How much is the fish and how much is the chips?

This can be reduced to: 3X+2Y=280  and  1X+2Y=260

We all remember these annoying double equations from school.

It took ages to solve using arcane algebraic methods that usually involved divisions and multiplications by delightful fractions like 1/2, 1/3 etc.

What a tricky, slow and annoying way to spend your precious childhood!

But it turns out a computer program can solve these equations in a couple of seconds using brute force: trying out thousands and millions of number combinations until there is a match.

The "fish and chips" example is preloaded. Feel free to use this on any similar set of equations.

Please use only integers (numbers without decimal points).

 First equation X * + Y * = Second equation X * + Y * = Limit: The limit will be set to the sum of the equation with the greater value. Maximum permitted is 3000. This will give 9 million combinations (3000x3000). (a limit of 100 is OK for "fish and chip" example)            This may take a few seconds Result:  running time:  milliseconds

Values for X or Y should not exceed 3000; this program is meant for an overage desktop not a supercomputer. If either X or Y are over 3000 the program will terminate with an error message.

The program will try up to 9 million X and Y combinations before giving up. This is an artificial limit: it would be trivial to change the code so this program would run for minutes, hours and even days, crunching though many trillions of combinations. But as this webpage is for illustration purposes only, the runtime is sensibly limited to a few seconds.

If there is more than one possible solution, only the first one will be output.

 But the "fish and chips" example is far too easy for this program. As neither X nor Y are greater than 100, they can be solved with a limit set to 100 in a split second. Let's try a truly mind-boggling set of equations that will really tax your browser's processing power: 4 boxes of processors and 3 boxes of SD readers cost \$189.77 7 boxes of processors and 5 boxes of SD readers cost \$324.68 Reduced to: 4X+3Y=18977  and  7X+5Y=32468 How much is the box of processors and how much is the box of SD readers?            This will take a few seconds Result:

Disclaimer: use in moderation - raw computing power is no substitute for learning mathematics, problem-solving skills and generally developing your brain. Just because there are calculators does not mean you no longer need to learn times tables.