Skip to content

This is a Rust program that finds all prime numbers up to a given limit using the Sieve of Eratosthenes algorithm. It's a beginner-friendly project that provides an opportunity to learn Rust programming, numerical methods, and algorithms

Notifications You must be signed in to change notification settings

Vaporjawn/Prime-Number-Finder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prime Number Finder

This is a simple Rust program that allows the user to find all prime numbers up to a given limit using the Sieve of Eratosthenes algorithm.

Usage

To use this program, follow these steps:

Install Rust on your system if you haven't already. You can download Rust from the official website at https://www.rust-lang.org/tools/install.

Clone this repository to your local machine using Git:

git clone https://github.com/vaporjawn/prime-number-finder.git

Open a terminal window and navigate to the directory where you cloned the repository.

Run the program using the following command:

cargo run

This will prompt you to enter a limit, and then display all prime numbers up to that limit.

Implementation

This program uses the Sieve of Eratosthenes algorithm to find all prime numbers up to a given limit. The algorithm works by creating a list of numbers from 0 to the limit, and then eliminating all multiples of each prime number from the list. The resulting list contains only prime numbers.

The implementation of the algorithm in this program uses a Vec to represent whether each number up to the limit is prime or not. It starts with all numbers marked as prime, except for 0 and 1, which are not considered prime. Then it uses the Sieve of Eratosthenes algorithm to eliminate multiples of each prime number from the list of potential primes. Finally, it filters the list of numbers to only include those that are marked as prime, and returns them as a Vec.

Contributing

If you find a bug in this program or would like to suggest an improvement, please feel free to submit an issue or pull request on GitHub. I welcome contributions from the community!

About

This is a Rust program that finds all prime numbers up to a given limit using the Sieve of Eratosthenes algorithm. It's a beginner-friendly project that provides an opportunity to learn Rust programming, numerical methods, and algorithms

Topics

Resources

Stars

Watchers

Forks

Languages