Jump to content
smus

equation solver

Recommended Posts

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 by Funce

Share this post


Link to post
Share on other sites

Could you describe what inputs and outputs you are expecting?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 by dsonesuk

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×