code for generating primes and if two rectangles x-y aligned rectangles intersect?