Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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
https://github.com/vaporjawn/prime-number-finder

computerscience mathematicalprogramming opensource primenumbers rust rust-lang sieveoferatosthenes

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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 .

Clone this repository to your local machine using Git:

```bash
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:

```arduino
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!