The prime cluster of an integer N higher than 2 is defined as the pair formed by the highest prime strictly lower than N and the lowest prime strictly higher than N.
Note that following the definition above, if the integer is a prime itself, then its prime cluster is the pair of the primes preceding and succeeding it.
Task
Given two integers integers N, M (N, M ≥ 3), output a truthy / falsy value based on whether N and M have the same prime cluster.
This is code-golf, so the aim is to reduce your byte count as much as possible. Thus, the shortest code in every programming language wins.
Test cases / Examples
For instance, the prime cluster of 9 is [7, 11]
, because:
- 7 is the highest prime strictly lower than 9, and
- 11 is the lowest prime strictly higher than 9.
Similarly, the the prime cluster of 67 is [61, 71]
(note that 67 is a prime).
Truthy pairs
8, 10 20, 22 65, 65 73, 73 86, 84 326, 318 513, 518
Falsy pairs
4, 5 6, 8 409, 401 348, 347 419, 418 311, 313 326, 305