Note: This example uses brute force, which, while teachin me things about Rust’s Functional Programming Features, is not a very elegant solution to the given problem. It will stop before computing the result if running in Debug Compiled mode.

Table of content

What is this :grey_question:

The rules of the game are explained in my original post.

21st Challenge

Challenge

Solve euler challange number 5.

Solution :white_check_mark:

	//Problem 5
	// [](https://projecteuler.net/problem=5)
	// 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
	// What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
	fn main() {
	    
	    let x =(1..)
	        .filter(|x| {(1..20).fold(0,|total,next|{total+x%next}) ==0} )
	        .take(1)
	        .last();
	    println!("{}",x.unwrap());

	}
	

To see the full source see github and see the live demo in playground.