Back
Close

My Own Prime

Statement
The program:
For a given set of positive integers S let's call X a prime if there are no elements in S which are divisors of X(except X itself) .
INPUT:
Line 1: It contains one integer N - size of the set S.
Line 2: It contains N space-separated integers - elements of S.

OUTPUT:
You must output all X which are Own Primes .
Note:The Output numbers must be in the same order as given in the input string.

CONSTRAINTS:
N<= 100
1 <= S[i] <= 106}(1<=i<=n)

Its guaranteed that all the numbers will pairwise different.

EXAMPLE:
Input
5
10 5 3 15 16
Output
5 3 16
 

Game modes
FastestShortest

Test cases
Test 1 Test
Input
5 10 5 3 15 16
Output
5 3 16

Validator 1 Validator
Input
10 2 8 15 1 10 5 19 3 6 7
Output
1

Test 2 Test
Input
6 2 3 5 7 1 11
Output
1

Validator 2 Validator
Input
20 42 68 35 4 70 25 79 59 63 65 6 46 82 28 62 92 96 43 7 5
Output
4 79 59 6 46 82 62 43 7 5

Test 3 Test
Input
1 20
Output
20

Validator 3 Validator
Input
50 42 468 335 501 170 725 479 359 963 465 706 146 282 828 962 492 996 943 437 392 605 903 154 293 383 422 717 719 896 448 727 772 539 870 913 668 300 36 895 704 812 323 334 674 665 142 712 254 869 548
Output
42 335 501 170 725 479 359 963 465 706 146 282 962 492 996 943 437 392 605 903 154 293 383 422 717 719 448 727 772 539 870 913 300 36 895 704 812 323 334 674 665 142 712 254 869 548

Test 4 Test
Input
100 4 9 17 20 22 28 29 31 39 40 48 58 68 75 85 89 99 100 101 108 111 121 124 129 135 137 141 147 156 160 161 165 173 182 189 199 205 214 215 220 229 239 243 253 261 264 268 278 281 287 293 300 307 308 311 313 315 322 332 342 344 354 358 368 378 380 381 386 388 391 401 404 409 414 416 420 428 433 436 438 440 449 450 459 460 463 473 475 476 485 489 492 493 502 504 514 516 520 525 528
Output
4 9 17 22 29 31 39 75 89 101 111 121 129 137 141 147 161 165 173 182 199 205 214 215 229 239 253 278 281 287 293 307 311 313 354 358 381 386 401 409 433 438 449 463 473 475 485 489 502 514

Validator 4 Validator
Input
50 42 468 335 501 170 725 479 359 1 465 706 146 282 828 962 492 996 943 437 392 605 903 154 293 383 422 717 719 896 448 727 772 539 870 913 668 300 36 895 704 812 323 334 674 665 142 712 254 869 548
Output
1

Solution language

Solution

Stub generator input
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants