We consider four variants of the RSA cryptosystem with an RSA modulus N = pq where the public exponent e and the private exponent d satisfy an equation of the form ed − k p 2 − 1 q 2 − 1 = 1. We show that, if the prime numbers p and q share most significant bits, that is, if the prime difference |p − q| is sufficiently small, then one can solve the equation for larger values of d, and factor the RSA modulus, which makes the systems insecure.