You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
OGordoo 65ba9208fc new subjects for rust exams 3 years ago
..
README.md new subjects for rust exams 3 years ago

README.md

nextprime

Instructions

Write a function that returns the first prime number that is equal or superior to the int passed as parameter.

The function must be optimized in order to avoid time-outs with the tester.

(We consider that only positive numbers can be prime numbers)

Expected function

pub fn next_prime(nbr: u64) -> u64 {

}

Usage

Here is a possible program to test your function :

fn main() {
    println!("The next prime after 4 is: {}", next_prime(4));
    println!("The next prime after 11 is: {}", next_prime(11));
}

And its output :

$ cargo run
The next prime after 4 is: 5
The next prime after 11 is: 11
$