https://github.com/amir13872/prime-plus
This Python script is a comprehensive tool designed to identify prime numbers within a specified range and provide insightful statistics about them. Utilizing the efficient Sieve of Eratosthenes algorithm, the program calculates all prime numbers up to a given limit and then filters them according to a user-defined range. The program not only ident
https://github.com/amir13872/prime-plus
prime prime-numbers primesense
Last synced: 3 months ago
JSON representation
This Python script is a comprehensive tool designed to identify prime numbers within a specified range and provide insightful statistics about them. Utilizing the efficient Sieve of Eratosthenes algorithm, the program calculates all prime numbers up to a given limit and then filters them according to a user-defined range. The program not only ident
- Host: GitHub
- URL: https://github.com/amir13872/prime-plus
- Owner: amir13872
- Created: 2024-08-08T07:15:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-07T12:01:31.000Z (about 1 year ago)
- Last Synced: 2025-04-08T11:44:40.524Z (6 months ago)
- Topics: prime, prime-numbers, primesense
- Language: Java
- Homepage:
- Size: 15.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PrimeSense
PrimeSense is a Python project that offers powerful functionalities to find prime numbers within a specified range using the Sieve of Eratosthenes algorithm. This project includes features to calculate prime statistics, such as the count of primes and the last three prime numbers in a given range.
## Features
- **Sieve of Eratosthenes Algorithm**: Efficiently calculates all prime numbers up to a given `n`.
- **Range-based Prime Finder**: Finds all prime numbers within a specified range `[start, end]`.
- **Prime Statistics**: Provides the count of prime numbers and the last three prime numbers in the specified range.
- **User Input Validation**: Ensures user inputs for range are valid and handles errors gracefully.## Functions
### `sieve_of_eratosthenes(n)`
Returns a list of prime numbers up to `n` using the Sieve of Eratosthenes algorithm.
### `find_primes_in_range(start, end)`
Finds all prime numbers in the range `[start, end]`.
### `prime_statistics(start, end)`
Provides the last three prime numbers and the count of prime numbers in the range `[start, end]`.
### `get_user_input()`
Prompts the user to enter the start and end of the range, with validation.
### `display_results(start, end, last_three_primes, count_of_primes)`
Displays the results of the prime number calculations.
## Usage
To use PrimeSense, simply execute the `main()` function which prompts for user input and then displays the calculated prime statistics.
```bash
python primesense.py
```
## Contributing
Contributions are welcome! If you have suggestions or improvements, please fork the repository and create a pull request or email your respond to me.
```
mahnaznamani007@gmail.com
```
## License
This project is licensed under the MIT License - see the LICENSE file for details.
```
Ensure that the file name `primesense.py` matches the actual name of your Python script. This `README.md` provides a comprehensive overview of the PrimeSense project, its features, usage instructions, and guidelines for contributing.
```