Once you have the next prime number, the sequence will work up to the square of that prime number.  5^2=25.  Numbers between 3 and 25 that are not prime will be excluded by the exclusion lines, whatever is left will be prime, Keep going round up to 25 ~ breakdown at 25.