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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...