# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

IUT CSE’16 batch students have completed their C Programming Course. As they are so dexterous programmer, they can solve almost all the problems which are assigned to them.

Now, IUT Programming Community (IUTPC) have been informed regarding the awesome programming skills of these young coders. IUTPC have arranged an immediate meeting about how to tackle these first year students by giving them a challenging problem to solve.

In the meeting, IUTPC have proposed the following problem . As first year students are quite new, so IUTPC have not proposed any stopper problem either. Also, 2nd and 3rd students are very hungry (As there are some AWESOME and INCREDIBLE programmers in CSE’14 and CSE’15) and whenever they see a problem, they start solving it.

Being a student of **xth** year, can you solve the following problem?

Given a number **n**, you have to print the first **n*n** prime numbers in the following pattern (See the sample output for details).

Take a single number **n (0 < n ≤ 800)** as input.

See the sample output for details.

Input | Output |
---|---|

1 |
2 |

Input | Output |
---|---|

3 |
2 3 5 19 23 7 17 13 11 |

Input | Output |
---|---|

2 |
2 3 7 5 |

Input | Output |
---|---|

5 |
2 3 5 7 11 53 59 61 67 13 47 89 97 71 17 43 83 79 73 19 41 37 31 29 23 |

90% Solution Ratio

Sherlock221bEarliest,

BRUR_DivByZeroFastest, 58032.6s

BRUR_DivByZeroLightest, 11 MB

masum_iceShortest, 792B

Login to submit