r/MathHelp • • Aug 24 '20

I forgot the method of solving this aside from brute forcing it.

I ran into a problem while playing a game called west of loathing. It was simple enough to brute force but I know there is a more elegant method to solving it and I am darn pissed I can't remember it.

anyway

The elevator needs 3200Ibs in order to work. There are 3 bolts that adds weight to the elevator. Each bolt adds a specific amount to the elevator.

Bolt / Ibs

3 / 411

5 / 295

7 / 161

. . . . . . . . In order to add up to 3200, you need to

Tighten Bolt #3 4 Times = 1644

Tighten Bolt #5 2 Times = 590

Tighten Bolt #7 6 Times = 966

9 Upvotes

10 comments sorted by

4

u/oneroastformeplease Aug 24 '20

I basically started by taking the largest number to the highest value price is right style going and down while I used the remainder until I reached an answer divisible by the following numbers

1

u/Swedey_Balls Aug 24 '20

Was there any other information given or have you written everything in your OP?

1

u/oneroastformeplease Aug 24 '20

yeah its all written there pretty much if you would like to reference the problem it should be under west of loathing soupstock lode elevator

2

u/Swedey_Balls Aug 24 '20

A more elegant way of solving it would be to use a system of equations with 3 variables but there is only enough information to make 1 equation.

411x + 295y + 161z = 3200

You could find maximums to narrow it down. X cannot be more than 8.Y cannot be more than 10 and Z cannot be more than 19.

But after that I believe you need to "brute force" it :)

4

u/super_ag Aug 24 '20

And equation would be weight = 411x + 295y + 161z = 3200

One equation with three variables has infinite solutions. Of course, I'm assuming the problem requires you to use integers and you can't use half or 3/32th of a bolt.

But a little intuition can help narrow the answer down. You need to end with 00. The sum of the one's digits of each bolt is going to need to equal a two-digit number ending in 0, such as 10 or 20. So two equations you can make is x + 5y + z = 10 or x + 5y + z = 20.

Now you can use trial and error with values of 0, 1 or 2 for y.

y = 0

You're left with 411x + 161z = 3200 and x + z = 10. You now have two variables with two equations. You can solve this set:

  • x = 10-z

  • 411(10-z) + 161z = 3200

  • 4110 - 411z + 161z = 3200

  • 4110 - 250z = 3200

  • -250z = 910

  • z = 3.64 This is not a valid answer since we must have an integer. So you can't solve this with 0 #5 bolts.

There's no sense in proceeding to x+z=20, since 20z = 3220, and that's the lowest possible weight you can achieve with that sum. You've already exceeded your target with the minimum value.

y = 1

This leaves you with the equation 411x + 295 + 161z = 3200 or 411x + 161z = 2905. Your second equation is x + 5(1) + z = 10 and can be simplified as x + z = 5 (or 15)

  • 411x + 161z = 2905 and x + z = 5 can be combined to give you

  • 411(5-z) + 161z = 2905

  • 2055 - 411z + 161z = 2905

  • 2055 - 250z = 2905

  • -250z = 850, you can stop here, since z must be negative to solve the equation and you can't have negative number of bolts

So now use x + z = 15 and see if that works

  • 411(15-z) + 161z = 2905

  • 6165 - 411z = 2905

  • -250z = -3260

  • z = 13.04. The answer is not an integer, so it's a no go. At this point too, you're already at a weight of 2099.44 lbs just for this value of z, so it's useless to proceed to x+z=25.

y = 2

Your equations are 411x + 590 + 161z = 3200, which is simplified to 411x + 161z = 2610. You'll also need x + z = 10 or x = 10-z

  • 411(10-z) +161z = 2610

  • 4110 - 411z + 161z = 2610

  • -250z = -1500

  • z = 6. Yay, an integer!

So it's still trial and error, but it's using a little deduction, setting limits and using equations to solve a problem you had to brute force.

1

u/oneroastformeplease Aug 24 '20

Thanks for the insight!!

2

u/gloopiee Aug 24 '20

This problem is inherently hard. But since the numbers are relatively small you can still brute force it.

1

u/AutoModerator Aug 24 '20

Reminder:

  • What have you tried so far? (See Rule #2)

  • Please don't delete your post. (See Rule #7)

We, the moderators of /r/MathHelp, appreciate that your question contributes to the MathHelp archived questions that will help others searching for similar answers in the future. Thank you for obeying these instructions.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/EricSeverson Aug 24 '20

Here's a good primer on the type of systems you are considering here:

https://brilliant.org/wiki/linear-diophantine-equations-one-equation/

It turns out there's an efficient way to find all integer solutions to your problem, but it's more difficult if you only want non-negative integer solutions. But the difficulty scales badly in the number of variables you have, so for only n=3 variables there are efficient algorithms.

For a much more technical reference, it looks like this paper https://www.sciencedirect.com/science/article/abs/pii/0196677488900259 gives an efficient algorithm for the n = 3 variable case of the problem here.