Solution for 'Prime Ranges' task