maths.twin_prime¶
== Twin Prime == A number n+2 is said to be a Twin prime of number n if both n and n+2 are prime.
Examples of Twin pairs: (3, 5), (5, 7), (11, 13), (17, 19), (29, 31), (41, 43), … https://en.wikipedia.org/wiki/Twin_prime
Functions¶
|
# doctest: +NORMALIZE_WHITESPACE |
Module Contents¶
- maths.twin_prime.twin_prime(number: int) int ¶
# doctest: +NORMALIZE_WHITESPACE This functions takes an integer number as input. returns n+2 if n and n+2 are prime numbers and -1 otherwise. >>> twin_prime(3) 5 >>> twin_prime(4) -1 >>> twin_prime(5) 7 >>> twin_prime(17) 19 >>> twin_prime(0) -1 >>> twin_prime(6.0) Traceback (most recent call last):
…
TypeError: Input value of [number=6.0] must be an integer