Skip to content

lucasalvaa/twin-primes-sieve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twin Primes Sieve

Coding project for the Analysis I exam.

Twin primes are pairs of primes that differ by 2, such as (5, 7), (11, 13), and (17, 19).
This program efficiently identifies such pairs in a given range using number theory and parallel computation.


🧠 How It Works

  • This program is based on the number theory fact that primes >3 are of the form 6k ± 1.
  • A set of four modular selection rules eliminates k-values that cannot generate twin primes.
  • The remaining values of k are transformed into candidate twin pairs (6k+5, 6k+7).
  • The statistics of each program run (range, pairs found and time elapsed) are saved in a text file called "resumes.txt".
  • The pairs of twin primes found are saved in a text file called "output.txt". This file is overwritten on every run.

📦 Build Instructions

Requires a C compiler (e.g., gcc) and make.

git clone https://github.com/lucasalvaa/twin-primes-sieve.git
cd twin-primes-sieve
make

🚀 Usage

./sieve <lower_bound> <upper_bound>

Example:

./sieve 1 100000000

👤 Author

Developed by Salvatore Luca (@lucasalvaa) and Squitieri Andrea (@Andeser-rgb)

About

"Analysis I" course coding project

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published