Factor one print function into two

The original print function is too long, since the function  prints one line indicating the page number and print the prime numbers found. Thus, the print function can be spliced into two functions, so that each function will be shorter and easier to understand.