isPrime with right + 1 elements, all set to true except for indices 0 and 1.isPrime by iterating from 2 to sqrt(right) and marking multiples of each number as false.left to right, and for each prime number found, check if it forms a pair with the previous prime number with a smaller difference than the current minimum.[-1, -1] otherwise.