Need some intelligent people...
-
It's been a long time since i did any really hard maths and a friend of mine just asked me the following question: "How can I easily find all possible solutions for 3125r = 1024x - 8404 where r and x are both integers, and r is divisible by 5" Any very intelligent people out there who know of an answer?
-
It's been a long time since i did any really hard maths and a friend of mine just asked me the following question: "How can I easily find all possible solutions for 3125r = 1024x - 8404 where r and x are both integers, and r is divisible by 5" Any very intelligent people out there who know of an answer?
Hi, there is an infinite number of solutions, given by: r=1020+5120t x=3121+15625t where any value of t will do. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Hi, there is an infinite number of solutions, given by: r=1020+5120t x=3121+15625t where any value of t will do. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
I thought there would be any number of solutions (with no particular grounding or proof). But that's certainly a faster way of finding them...
-
Hi, there is an infinite number of solutions, given by: r=1020+5120t x=3121+15625t where any value of t will do. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
Would it be an impudent question to ask how you arrived at this solution? Trying to work back from your solution leaves me a bit stumped...
-
Would it be an impudent question to ask how you arrived at this solution? Trying to work back from your solution leaves me a bit stumped...
Hi Paddy, there are several ways to find the solution(s) of ax+by=c. First of all a single, linear equation in two variables has either no solution at all (say 2x + 4y = 1) or an infinite number, by adding the second coefficient to the first number and subtracting the first coef from the second number. So the main problem is to find a first solution. Method 1: write a little prog, assume x=u+bt and y=v-at and have it try a lot of values u (keep t at 0) and calculate real v until it happens to be integer. Method 2: follow the strict mathematical approach; that's what you would need if decent code is required to solve such problems in general Method 3: the way in-between, with a couple of shortcuts, the ideal way to solve a single problem manually. Like so: 3125r = 1024x - 8404 with constraint r=multiple of 5 lets try to replace variables by other variables and reduce the size of the constants: right hand side is multiple of 4, hence r must be multiple of 20, say r=20a 3125 * 20a = 1024x - 8404 15625a = 256x - 2101 lets ignore all multiples of the smallest coef, 256 15625=61*256+9 -2101=-9*256+203 9a = 203 (modulo 256) try a couple of numbers 203 + 256k until a multiple of 9 is found; this is bound to happen in 9 tries ! one immediately sees a solution is a=(203+256)/9=51 (this is where the mathematician would go more formally !) hence r=1020, then calculate the x that goes with it, and add one variable t with the right coefs. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
-
Hi Paddy, there are several ways to find the solution(s) of ax+by=c. First of all a single, linear equation in two variables has either no solution at all (say 2x + 4y = 1) or an infinite number, by adding the second coefficient to the first number and subtracting the first coef from the second number. So the main problem is to find a first solution. Method 1: write a little prog, assume x=u+bt and y=v-at and have it try a lot of values u (keep t at 0) and calculate real v until it happens to be integer. Method 2: follow the strict mathematical approach; that's what you would need if decent code is required to solve such problems in general Method 3: the way in-between, with a couple of shortcuts, the ideal way to solve a single problem manually. Like so: 3125r = 1024x - 8404 with constraint r=multiple of 5 lets try to replace variables by other variables and reduce the size of the constants: right hand side is multiple of 4, hence r must be multiple of 20, say r=20a 3125 * 20a = 1024x - 8404 15625a = 256x - 2101 lets ignore all multiples of the smallest coef, 256 15625=61*256+9 -2101=-9*256+203 9a = 203 (modulo 256) try a couple of numbers 203 + 256k until a multiple of 9 is found; this is bound to happen in 9 tries ! one immediately sees a solution is a=(203+256)/9=51 (this is where the mathematician would go more formally !) hence r=1020, then calculate the x that goes with it, and add one variable t with the right coefs. :)
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google
Thanks very much for your time :o)
-
It's been a long time since i did any really hard maths and a friend of mine just asked me the following question: "How can I easily find all possible solutions for 3125r = 1024x - 8404 where r and x are both integers, and r is divisible by 5" Any very intelligent people out there who know of an answer?
-
It's been a long time since i did any really hard maths and a friend of mine just asked me the following question: "How can I easily find all possible solutions for 3125r = 1024x - 8404 where r and x are both integers, and r is divisible by 5" Any very intelligent people out there who know of an answer?
Just in case Luc's asleep (seems to be never) you could use this applet[^] and solve -1024x + 15625y + 8404 = 0 then use r = 5y. If you tick the box 'Step-by-step' it even shows all working! The source code for this applet is 3742 lines long! (mostly to do with the quadratic problem I guess)
Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
-
Just in case Luc's asleep (seems to be never) you could use this applet[^] and solve -1024x + 15625y + 8404 = 0 then use r = 5y. If you tick the box 'Step-by-step' it even shows all working! The source code for this applet is 3742 lines long! (mostly to do with the quadratic problem I guess)
Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
cp9876 wrote:
seems to be never
Really? Gee I must be sleeptyping again. :laugh:
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips: - make Visual display line numbers: Tools/Options/TextEditor/... - show exceptions with ToString() to see all information - before you ask a question here, search CodeProject, then Google