Find all the prime numbers (such as 2, 3, 5, 7, 11, 13, 17, 19, …) between 1 and 4027. To print the primes, write a function which prints a list in a table which “reads down”, using as few rows as possible, and using as few sheets of paper as possible, given the number of columns for the table. Print this table to a text file. The parameters of the functions should be the list, the number of columns desired, and a file or file name, if used. (For the purposes of this project, open the file and print the table using an editor or word processor.) Each number should be right-justified in its column. The height of the columns should all be the same, except for perhaps the last column, which might have a few blank entries toward its bottom row.
After printing the table of primes, print a second table (to a separate file) of the twin primes found among the original prime numbers, again reading down. Finally, print to the console the following statistics: number of primes found and the number of twin prime pairs found