A list of puns related to "Euclid's Algorithm"
u_n=2^(n)-1
u_(n+p) = u_n * (u_(p)+1) + u_p
We know that GCD(u_n , u_p) =GCD(u_n , u_(n+p))
Then, we have a and b, a >= b, and r the rest of the a and b euclidean division.
I want to get GCD(u_b , u_r) = GCD(u_a , u_b) and GCD(u_a , u_b) = u_(GCD(a , b))
My teacher said me that we can use the Euclid algorithm.
Can you help me ? I don't know how so that
I've been tasked with showing how the discreet logarithm problem mis 'easy' on a group of integers modulo 'a' prime 'n' under addition, ie:
Find an x such that x . g == h (mod n)
Not so much as looking for an answer so as to just help understanding this shit because my brains about to fucking explode and I can't go get proper support because my uni is closed. My textbook states it's "easy to solve the additive discreet logarithm problem bla bla using extended gcd" but provides nothing furhter on this. It's legit a full stop.
How does one apply this?
I know the extended gcd(a,b), rather than giving just [gcd(a,b)], gives values [x, y, gcd(a,b)] such that x.a + y.b = gcd(a,b)
How does this help me?
Thanks <3
I'm in my first year studying for a degree in maths. And as an introduction to number theory my textbook talks about Euclid's algorithm for finding the highest common factor (HCF) of two integers.
I can apply it well enough. Say if I wanted to find the HCF of 50 and 34:
50 = 34 * 1 + 16
34 = 16 * 2 + 2
16 = 2 * 8 + 0
So the HCF of 50 and 34 is 2.
I can see that the point of each stage is to find two integers that are smaller and that also contain the highest common factor of the original integers. But I'm having trouble seeing why the remainder also contains the highest common factor.
For example, in the first step to the above problem:
50 = 34 * 1 + 16
I'm looking for the HCF of 50 and 34, so of course 34 has to contain this highest common factor. But why does 16 also contain the HCF? It just seems to be some arbitary remainder.
By Euclid algorithm, I refer to the algorithm to output GCD of two integers when they were inputted.
As I give two non-integral floating point number (3.14,3.1415) to my program, a very small number (4.440892098500626e-16) is outputted.
How should I interpret the small number?
This is an implementation of Euclid's algorithm! It works as a function you can call with a Dictionary, more on that later.
Download: https://www.icloud.com/shortcuts/5b95e1bbefd340e1bf934786723de821
Run it like this: https://www.icloud.com/shortcuts/b1b26e4cd06943d59f5835e5cbf20b95
This works because the Euclid shortcut receives a dictionary like {a: 100, b: 50}
. To get the values we store this dict as a variable, then get each key as a variable. This is a really cool way to use named parameters in shortcuts!
From here, we do the standard logic for Euclid's algorithm:
const gcd = (a, b) =>
{
if (b === 0) { return a; }
else { return gcd(b, a % b); }
}
Enjoy! I hope this use of parameters shines some light on how powerful these can be!
Alright, so I've implemented it like so, and this doesn't seem to work well enough. Any input that actually incurs recursion just returns "none." Neither me nor my professor can quite pin-point what the issue is. Anyone got some ideas?
Hello fellow learnmathers.
I'm sitting here this fine Friday evening doing some algebra. I can apply Euclid's algorithm just fine and arrive at the correct answer. But I have one problem. Let's take an example.
Find the greatest common divisor of 1859 and 286:
Divide 1859 with 286. It goes 6 times with a remainder of 143.
Divide 286 with 143. It goes 2 times with no remainder. Thus the greatest common divisor of 1859 is 143.
It was an easy example with only two steps. But it's not intuitive to me why the greatest common divisor of the starting numbers must also be a divisor of the remainder, even when there are many more steps. I don't see the relationship between the remainder and the starting numbers. Is there a way to explain why it works?
I'm having trouble understanding my teacher's notes and how to solve for x.
I would really appreciate it if someone show step by step on how to get the answer for these problems:
Hey guys, just need help with the last detail here! I'm doing diophantic equations and I'm getting stuck when I face longer sequences.
This is what I'm currently dealing with:
16x+9y=1
16=9+7
9=7+2
7=3*2+1
Then
1= 7 - 3(2) = 7 - 3(9-7) = 7 - 3(9-(16-9))
How and when do I get rid of the 7?
Hello there r/learnprogramming. I'm new to programming and starting with Python, which I've studied on and off for the past few weeks now. For kicks, I'm trying to make Euclid's algorithm as a Python script (specifically, I'm trying to code the flowchart here.)
The code I've made so far can be found on codepad here. For several different inputs, the script works just fine; however, some (especially those with different numbers of digits, though I don't know if this is significant) has it bringing an error which looks like this:
File "C:\Python27\Scripts\stuff\EuclidMethod.py", line 21, in euclid2
euclid1(number1, number2)
File "C:\Python27\Scripts\stuff\EuclidMethod.py", line 17, in euclid1
euclid2(number1, number2)
[the above 4 lines repeat over and over until...]
RuntimeError: maximum recursion depth exceeded
This has me stumped, as I'm not sure of a way to script this without using recursion. If additional documentation is needed to more fully explain the code, I'll be happy to provide it. Thanks in advance!
EDIT: answer found by using a while loop. My gratitude to naxir.
It's a basic proofs class I'm taking, and so far I've done great. But something about this topic just threw me off. I don't know if there was just a missed connection I failed to make in class or what. I don't feel I get the concepts involved all the way. Anyway, last class we learned the Euclidian algorithm, and the division algorithm. He also pointed out the two corollaries that derive out of that, one of them says there is an integer solution to ax+by =1 if and only if the gcd(a,b) = 1. The other, IF i wrote it down correctly, states that ax + by = n has a solution for every n if and only if gcd(a,b) = 1. He also pointed out that the first corollary was very helpful in this proof...... So far I've tinkered with all of this algebraically. But I just end up with a poo mess when I do. I feel there's a connection I'm failing to make because something wasn't really explained to me well enough. Anyway, I'm not looking for the proof to this, but if you can nudge me in the right direction, or help me understand something better, please do. I'm tearing my hair out over this. Thank you so much.
EDIT: I completely forgot to write out the proof haha. Proposition: If a divides bc AND gcd(a,b) =1, then a divides c.
Hey guys, just need help with the last detail here! I'm doing diophantic equations and I'm getting stuck when I face longer sequences.
This is what I'm currently dealing with:
16x+9y=1
16=9+7
9=7+2
7=3*2+1
Then
1= 7 - 3(2) = 7 - 3(9-7) = 7 - 3(9-(16-9))
How and when do I get rid of the 7?
Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.