Click here to Skip to main content
13,598,183 members
Click here to Skip to main content
Add your own
alternative version


1 bookmarked
Posted 18 Feb 2011
Licenced CPOL

Fast Greatest Common Divisor (GCD) Algorithm

, 18 Feb 2011
Rate this:
Please Sign up or sign in to vote.
It is better to do this:public static long LCM(long a, long b){ return (a / GCD(a,b)) * b;}To avoid overflow on big numbers.
It is better to do this:

public static long LCM(long a, long b)
    return (a / GCD(a,b)) * b;

To avoid overflow on big numbers.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Mauro Leggieri
Web Developer
Argentina Argentina
My name is Mauro Leggieri. I am 30 year-old, married and have a child.

I am a system engineer (UTN university) and am being programming for more than 20 years from the C64 to the PC and some microcontrollers.

Mostly of my time, I program games for Windows.

Soon, my site

You may also be interested in...


Comments and Discussions

GeneralHi Mauro, You are absolutely right; that's exactly how it's... Pin
DrABELL18-Feb-11 8:48
memberDrABELL18-Feb-11 8:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04-2016 | 2.8.180621.3 | Last Updated 18 Feb 2011
Article Copyright 2011 by Mauro Leggieri
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid