olivereanderson / iterator_modulo

Primality test not touching the built-in arithmetic operators for primitive types in Rust.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is my solution to the following challenge: Check if a usize is a prime number in Rust without touching the built-in arithmetic operations (+, -, *, /, %) for the numeric primitive types. We are allowed to call functionality from the standard library that may use some of these arithmetic operations under the hood.

We emphasise that the code we present here is only a solution to an exercise and not suitable for real world problems. The prime checker we produce is indeed extremely slow! The only real value of this repository is for the novice Rust developer to get some practice with the yoga of iterators, const generics and modules.

About

Primality test not touching the built-in arithmetic operators for primitive types in Rust.


Languages

Language:Rust 100.0%