Practice on Toph

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

Can IUTPC Resist the Coders?

By CLown1331 · Limits 500ms, 512 MB

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
Input Output
2 3 5
19 23 7
17 13 11
Input Output
2 3
7 5
Input Output
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, Oct '17

BRUR_DivByZeroFastest, 58032.6s

BRUR_DivByZeroLightest, 11 MB

masum_iceShortest, 792B


Login to submit

Related Contests

18th IUT Computer Programming Contest 2017 Ended at 2017-10-04 12:20:00 +0000 UTC
Replay of 18th IUT Computer Programming Contest 2017 Ended at 2017-10-11 16:00:00 +0000 UTC