Rust Implementation of Problem 7

View source code here on GitHub!

Includes

Problem Solution

pub fn problems::p0007::p0007() -> utils::Answer
 1/*
 2Project Euler Problem 7
 3
 4The prime number infrastructure paid off here
 5
 6Problem:
 7
 8By listing the first six prime numbers: 2, 3, 5, 7, >
 9
10What is the 10 001st prime number?
11*/
12use crate::include::primes::primes;
13use crate::include::utils::Answer;
14
15pub fn p0007() -> Answer {
16    return Answer::Int(
17        primes::<u64>()
18            .take(10001)
19            .last()
20            .unwrap()
21            .into()
22    );
23}

Tags: prime-number, rust-iterator