What İs Euclidean Algorithm ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 13

What İs Euclidean Algorithm ?

Show With Examples

18th Dec 2018, 6:26 PM
Serhat İbin
Serhat İbin - avatar
4 Answers
+ 18
both A and B. The Euclidean Algorithm is a technique for quickly finding the GCD of two integers. The Algorithm The Euclidean Algorithm for finding GCD(A,B) is as follows: If A = 0 then GCD(A,B)=B, since the GCD(0,B)=B, and we can stop.  If B = 0 then GCD(A,B)=A, since the GCD(A,0)=A, and we can stop.  Write A in quotient remainder form (A = B⋅Q + R)Find GCD(B,R) using the Euclidean Algorithm since GCD(A,B) = GCD(B,R) Example: Find the GCD of 270 and 192 A=270, B=192A ≠0B ≠0Use long division to find that 270/192 = 1 with a remainder of 78. We can write this as: 270 = 192 * 1 +78Find GCD(192,78), since GCD(270,192)=GCD(192,78) A=192, B=78 A ≠0B ≠0Use long division to find that 192/78 = 2 with a remainder of 36. We can write this as:192 = 78 * 2 + 36Find GCD(78,36), since GCD(192,78)=GCD(78,36) A=78, B=36 A ≠0B ≠0Use long division to find that 78/36 = 2 with a remainder of 6. We can write this as:78 = 36 * 2 + 6Find GCD(36,6), since GCD(78,36)=GCD(36,6) A=36, B=6 https://code.sololearn.com/clI7T6Lb
18th Dec 2018, 7:16 PM
AKS
AKS - avatar
+ 10
Euclidean algorithm https://en.wikipedia.org/wiki/Euclidean_algorithm Before asking a question on the Q/A, try to search :  • Google Advanced Search : Set domain to 》sololearn.com《 for  search only on the SoloLearn https://www.google.com/advanced_search   • Eclipse Wiki : "Before asking a question on the forums" https://wiki.eclipse.org/Before_asking_a_question_on_the_forums https://code.sololearn.com/W26q4WtwSP8W/?ref=app https://www.sololearn.com/learn/4716/?ref=app https://code.sololearn.com/cy9NHIRCXYwb/?ref=app
19th Dec 2018, 9:20 AM
Danijel Ivanović
Danijel Ivanović - avatar
+ 2
Eucledon Algorithm is a technique of quickly find the GCD(Greatest Common Divisor)of two numbers. e.g. gcd(a,b) if(b==0) return a; else { return gcd(b,a%b) }
19th Dec 2018, 5:51 AM
WASEEM MEHR
WASEEM MEHR - avatar
+ 1
I actually had no clue about this, so it is interesting to hear about it. I enjoyed reading up on it and it seems like a very useful algorithm!
20th Dec 2018, 1:06 AM
Jacob Knox
Jacob Knox - avatar