Skip to content

Conversation

@laura-abro
Copy link
Owner

Feature: Prime Number Checker Implementation

Description

Task

Implement Prime Number Checker

Acceptance Criteria

  • Function should return boolean indicating if number is prime
  • Implement efficient primality test
  • Handle edge cases (negative numbers, 0, 1)
  • Include unit tests for various cases

Summary of Work

Overview

This pull request implements a robust and efficient Prime Number Checker function that determines whether a given integer is prime.

Changes Made

  • Created src/prime_checker.py with is_prime() function
  • Implemented comprehensive primality checking algorithm
  • Added tests/test_prime_checker.py with thorough test coverage

Implementation Details

Prime Number Checker (src/prime_checker.py)

  • Function: is_prime(number)
  • Key Features:
    • Input validation for integers
    • Efficient primality checking algorithm
    • O(sqrt(n)) time complexity
    • Handles edge cases (0, 1, negative numbers)

Validation and Error Handling

  • Raises ValueError for non-integer inputs
  • Returns False for numbers less than 2
  • Checks divisibility up to square root of the number

Testing Approach

  • Comprehensive test suite covering:
    • Known prime numbers
    • Known non-prime numbers
    • Large prime and non-prime numbers
    • Invalid input types
    • Negative numbers
  • All tests passing (6/6 tests)

Acceptance Criteria

  • Correctly identifies prime numbers
  • Handles edge cases and invalid inputs
  • Efficient implementation
  • Thoroughly tested

Performance Considerations

  • Time complexity: O(sqrt(n))
  • Space complexity: O(1)

Notes

  • Recommended for use in mathematical and computational tasks requiring prime number verification

Changes Made

  • Created src/prime_checker.py with is_prime() function
  • Implemented primality checking algorithm
  • Added comprehensive input validation
  • Created tests/test_prime_checker.py with comprehensive test suite

Tests

  • Test known prime numbers
  • Test known non-prime numbers
  • Test large prime numbers
  • Test large non-prime numbers
  • Test invalid input handling
  • Test negative number handling

Signatures

Staking Key

5EmgCQSgPD79JWPQ6KMAV35kUNxasNQymeWuQXfJPmVk: 2few3WtbcqbKqdVwzaM2btJMZxYJSMnJkddJqKgQz3AnxaEyehVaT2KKyWjiijYmFdvJjyycvuPtzYfioR17BCT6AnbSNoXzNBG4rLKzHwfSWYcdjpzxNHViChe4kLkFqS3UYiz2uwY7vAoUyHnGtJtfkJDF2CFNWL1qJmg7j4wiDCbUb5mJeodWedi8i4iKzr3yPXqPKza6rpySYSJ9w8RCg6NxmdWeeikevgHAw9ugkShGvHq34bYjyw69brhxKvvsnfnzbxaePdgj7S8JRcB1x1RPaUFZAr1RfNrj7Uk18D5MtRyabEKhiF7bkonMjzwaDYaSc4TYMR9jb3nEmMxqayfnv1DZCJZ8zS81ppxREm4iuBZ2ZcMV23PoThBeB6cYwC77BrbjFqN6JfrmyUcY9c6NyZHg8

Public Key

8U4eXGpP28X2i8wDEDxwGUdSdPuz7xuMBvpFuVyPDNKz: 7jzyp3LpRDBEyF2ZTHW83er5KEJAy1qixT1zgzXkz2XyTtP53mvQPgoJz5rzts2DrzQuSAXYmi2W6SkXcUyifP1gjWDKxNxL3Hr69HomPGo7mZ4B7MNA5X52UyuNikriHHH6Yaq5v2ShbNjK9LbKx1kQhVRXQCfvDMCzd8n4kyScaH3gmMexyUAN23HhRUj8CoKdiddzZfbKcPUJQio6soGKUvjFTCanR2xN27igYNc83gbaYDzxNzuuu1ctJeUSJscXEpKwydWYMd8vZP95PMtXb55ZKmeiqNoLSczUZE3xaays1HHBieio1MEMMPNMmhHcMdKrYhCsCR1Wii8naj3DyWiFkwMRwXSxANdh76wWi4MuaPLuYdDDSy8BvGK5rwSvBRsG92Wsg948CpWtio2qF87ugvciG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants