12=4524x+3564y, x and y must be integers. how do i solve this?
>>303659
There are infinite combinations. You need another equation.
>>303659
One Equation, two variables --> infinite solutions.Put in sth for x and you can calculate a y for each x.
12 = 4524x+3564y
1 = 377x+297y
297
217
137
57
354
274
194
114
34
331
251
171
91
11
308
228
148
68
365
285
205
125
45
342
262
182
102
22
319
239
159
79
376
x = 26, y = -33
>>303673
how
i mean thanks. but how? i also tried a lot with 377 and 297 and i also got to the 80 which you're substracting there. but how do you get from 57 to 354?
>>303676
nevermind. added 297 obviously. now i just need to explain to myself why that works.
>>303676
Subtracting 80 is shorthand for taking the remainder of n*297 when divided by 377. Once you get either 1 or -1 (i.e. 376), that's your solution for y.
If you're doing it by hand (as I actually was), once you get a remainder below 80, you subtract 80 from it, then add the result to 377. 57 - 80 + 377 = 354.
Since it took n=33 to get a remainder of 376, which again, is equivalent to a remainder of -1, we get y=-33.
>>303666
12=Ax+By
-->12-Ax =By
-->12-Ax / B = y
-->12-4524x /3564 = y
-->12/3564 - (4524/3564)x = y
-->1/297 - 1131/891 x
-->1/297 - 377/297 x = y
-->(1-377)x / 297 = y
Put in values for x until quotient is integer
-->x = 26 --> y=-33
>>303688
Well "must be integer" is not a directly in usable way addable property, you can surely add it in math language as x,y E Z but it doesn't in any way help with the calculation, so yeah at the end iterative solving (in laymans terms: Trying) is needed. You either put in 26 values for x and calculate the result, or you have to 33 times subtract 80 from 297, keeping the rollover in mind.
Pick your poison.
>>303688
I was doing a poor job of explaining things, what I used is modular arithmetic.
https://en.wikipedia.org/wiki/Modular_arithmetic
Once we have 1 = 377x+297y, basically, the quantities 377x and 297y have to have a difference of 1, right? It doesn't matter which quantity is the smaller one. So it follows that we're looking for an integer "n" such that either
297n = 1+377a
or
297n + 1 = 377a
For some integer a.
Stated another way, for this integer n, the remainder of 297n when divided by 377 must be either 1 or 376. So you go through
297n (mod 377) until it's congruent to 1 or 376.
You could also do this the other way, using 377n (mod 297), going for 1 or 296, which would've been faster in this case.
>>303693
okay thanks, i guess the teacher was just being an ass again.
>>303701
It's not possible faster than the smaller legit value.
like had you chosen to use x as the lonely variable you would have had to input 33 values for y until a hit. ON the other hand using the mod arithmetic vice versa would have resulted in only 25 steps.
The problem is you don't know which variable will lead to the faster result at first, it's pretty much a guess...