Skip to content

Instantly share code, notes, and snippets.

@nabetani
Last active December 11, 2015 09:08
Show Gist options
  • Save nabetani/4578037 to your computer and use it in GitHub Desktop.
Save nabetani/4578037 to your computer and use it in GitHub Desktop.
// see http://odz.sakura.ne.jp/projecteuler/index.php?cmd=read&page=Problem%205
def gcm( x, y ){
x=x as BigInteger;
y=y as BigInteger;
c=x.gcd(y);
return (( x / c ) * ( y / c ) *c)
}
println ( (1..20).inject(1){ i, j -> gcm( i, j )} )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment