This repository contains a Python script and a Mojo script that generates prime numbers and stores them in a JSON file, where the prime number is the key and its position in the prime sequence is the value. This data is particularly useful for cryptographic applications, research, and educational purposes. The current dataset contains all prime numbers between 1 and 5 million.
- Prime Range: This dataset includes prime numbers from 1 to 5 million.
- Incremental Prime Generation: Continuously add new prime numbers without duplicating existing data.
- Efficient Prime Lookup: Quickly retrieve prime numbers from a JSON dictionary.
./
├── .gitignore # Standard gitignore to exclude unnecessary files
├── prime.🔥 # Mojo script for generating prime numbers
├── prime.py # Main Python script for generating prime numbers
├── primes.json # JSON file containing prime numbers between 1 and 5 million
└── README.md # Project description and instructions
- Run the Python script:
python prime.py
- Input a prime limit: You will be prompted to enter the upper limit of prime number generation.
- Generated Output: The generated primes will be saved in
primes.json
in the format:{ "2": 1, "3": 2, "5": 3, "7": 4, "11": 5, ... }
- Install Mojo (if not already installed). Follow the instructions on the Mojo documentation for installation.
- Run the Mojo script:
mojo prime.🔥
- Input a prime limit: You will be prompted to enter the upper limit of prime number generation.
- Generated Output: Similar to the Python script, the generated primes will be saved in
primes.json
.
- Python 3.x
- Mojo (for the Mojo script)
Feel free to contribute by improving the algorithm or expanding the repository with larger sets of prime numbers.