An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p
and p±2
, that are both prime.
You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin pair, following the standard decision-problem rules (the values need to be consistent).
##Test Cases
Test Cases
Truthy (Twin Primes):
3, 5, 7, 11, 13, 17, 19, 29, 31, 41, 43
Falsy (not Twin Primes):
2, 15, 20, 23, 37, 47, 97, 120, 566
This is code-golf, so the shortest code in bytes wins!