Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 2 KB

README.md

File metadata and controls

52 lines (33 loc) · 2 KB

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.

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.

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.