a sophie germain prime is any prime p where 2p 1 is also prime the second number 2p 1 is called a safe prime examples of germain primes include 2 3 5 11 23 their corresponding safe primes 5 7 11 23 47 https en wikipedia orgwikisafeandsophiegermainprimes checks if input number and 2number 1 are prime isgermainprime3 true isgermainprime11 true isgermainprime4 false isgermainprime23 true isgermainprime13 false isgermainprime20 false isgermainprime abc traceback most recent call last typeerror input value must be a positive integer input value abc checks if input number and number 12 are prime the smallest safe prime is 5 with the germain prime is 2 issafeprime5 true issafeprime11 true issafeprime1 false issafeprime2 false issafeprime3 false issafeprime47 true issafeprime abc traceback most recent call last typeerror input value must be a positive integer input value abc checks if input number and 2 number 1 are prime is_germain_prime 3 true is_germain_prime 11 true is_germain_prime 4 false is_germain_prime 23 true is_germain_prime 13 false is_germain_prime 20 false is_germain_prime abc traceback most recent call last typeerror input value must be a positive integer input value abc checks if input number and number 1 2 are prime the smallest safe prime is 5 with the germain prime is 2 is_safe_prime 5 true is_safe_prime 11 true is_safe_prime 1 false is_safe_prime 2 false is_safe_prime 3 false is_safe_prime 47 true is_safe_prime abc traceback most recent call last typeerror input value must be a positive integer input value abc
from maths.prime_check import is_prime


def is_germain_prime(number: int) -> bool:
    
    if not isinstance(number, int) or number < 1:
        msg = f"Input value must be a positive integer. Input value: {number}"
        raise TypeError(msg)

    return is_prime(number) and is_prime(2 * number + 1)


def is_safe_prime(number: int) -> bool:
    
    if not isinstance(number, int) or number < 1:
        msg = f"Input value must be a positive integer. Input value: {number}"
        raise TypeError(msg)

    return (number - 1) % 2 == 0 and is_prime(number) and is_prime((number - 1) // 2)


if __name__ == "__main__":
    from doctest import testmod

    testmod()