The First Meeting
Practice
3.3 (26 votes)
Easy
Math
Primality test
Problem
94% Success 9592 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Given an array, A, of length N. Find the absolute difference between the smallest and largest prime number in array A.

Input:
First line contains an integer, N, number of points.
Second line contains N space separated integers, \(A_i\), denoting the elements of the array A.

Output:
Print the absolute difference between the smallest and largest prime number in array A, otherwise 1.

Constraints:
\(1 \le N \le 10^6\)
\(1 \le A_i \le 10^6\)

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
22 votes
Tags:
ApprovedEasyMathOpenPrimality test
Points:20
16 votes
Tags:
ApprovedBasic ProgrammingEasyMathOpenPrimality testSieve
Points:20
114 votes
Tags:
EasyMathNumber TheoryPrimality test