Skip to content

Instantly share code, notes, and snippets.

@dholbrook
Forked from anonymous/playground.rs
Created May 18, 2017 17:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dholbrook/2ffd27ddc4170eb86e1fb42ab509a282 to your computer and use it in GitHub Desktop.
Save dholbrook/2ffd27ddc4170eb86e1fb42ab509a282 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
extern crate num_integer;
use num_integer::Integer;
// run at http://play.integer32.com/?gist=6e4b93f907407f67704430e60f771e1f&version=undefined
fn main() {
let e5 = euler5();
assert_eq!(e5, 232792560);
println!("Euler5 {}", e5);
}
fn euler5() -> u64 {
(2u64..20).fold(1, |acc, x| acc.lcm(&x))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment