Skip to content

Instantly share code, notes, and snippets.

@fstamour
Created December 9, 2013 23:53
Show Gist options
  • Select an option

  • Save fstamour/7883270 to your computer and use it in GitHub Desktop.

Select an option

Save fstamour/7883270 to your computer and use it in GitHub Desktop.
Minimal (templated) implementation of the least common multiple (LCM) of two number. (Requires my gist for GCD.)
template< typename T >
T lcm( T a, T b ) {
return a*b/gcd( a, b );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment