Skip to content

ADD Find the constant value in ax + by = c. as a question & solution in python #351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Find the constant value for a linear two variable equation i.e., ax + by = c.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get rid of the spaces on the folder name & file name?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also do rename the file to question.md


- a & b are given, you need to find the constant 'c' value, how you find it with two independent variables? And x,y can be integers, rational number, etc.
- Let's take few Examples:
<pre>
25x + 10y = c,
10x + 100y = c,
11x + 35y = c
</pre>

# Solution:

- Extended Euclidean Algorithm is one of such algorithm which help to find solutions of such problems. How?
- Extended Euclidean stated as:
<pre>
ax + by = gcd(a, b)
</pre>
- So, it becomes finding the gcd of two numbers and the problem solved.
- Check the Solution.py file for the solution.
17 changes: 17 additions & 0 deletions Task 1/Find the constant value in ax + by = c./Solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Here you will find the solution in python language

# Given two numbers in the form of equation:

# GCD function:
def GCD(a, b):
if a == 0:
return b
return GCD(b, a%b)


a,b = 5, 10
# Call GCD
result = GCD(a, b)
print(result)

# result is constnat value.