smus Posted November 22, 2018 Share Posted November 22, 2018 How do I solve the equation: 210x+65y=5 x and y must be integers Link to comment Share on other sites More sharing options...
Funce Posted November 22, 2018 Share Posted November 22, 2018 (edited) One: Have you posted this in the right place? I don't think this forum solves algebra... You'll need another equation to be able to solve that absolutely, but in integer terms x = 13n + 9, y = -42n - 29, n ∈ ℤ Edited November 22, 2018 by Funce Link to comment Share on other sites More sharing options...
smus Posted November 23, 2018 Author Share Posted November 23, 2018 yes, it's needed to be solved by js Link to comment Share on other sites More sharing options...
Ingolme Posted November 23, 2018 Share Posted November 23, 2018 Could you describe what inputs and outputs you are expecting? Link to comment Share on other sites More sharing options...
smus Posted November 23, 2018 Author Share Posted November 23, 2018 It's a part of a more complex task. 5 is already a result, it is a GCD (greatest common divisor) of those 2 integers (210,65). They are function input parameters, but now it has to return x and y, not only GCD. Link to comment Share on other sites More sharing options...
Funce Posted November 28, 2018 Share Posted November 28, 2018 Are you sure this is solvable, there's too little data for me to figure, ax + by = gcd(a, b) where a = 210, b = 65 Creates a geometric line of 42x + 13y = 1. You're going to need another equation to solve this one. There's a missing piece. Link to comment Share on other sites More sharing options...
dsonesuk Posted November 28, 2018 Share Posted November 28, 2018 (edited) You loop through values that can be divided into both without a remainder storing both in individual arrays from lowest value (65), then loop through both arrays from highest till match is found then break loop, that will be gcd(5). The remaining value can be retrieved by dividing 210 / 5 = 42 65 / 5 = 13 Edited November 28, 2018 by dsonesuk Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now