8 May 2024 Shift 2 — Prime Number Check

E · easyP · Verified PYQmath

Given a number N, check whether it is prime or not. Input: A single integer N.

Input
17
Output
YES
Loop from 2 to sqrt(N). If any number divides N → not prime. Handle N=1 as special case (not prime).
← 8 May 2024 (Basic) — Closest Multiple of Y to X9 May 2024 Shift 1 — Remove Duplicates from Array →
Report an issue with this question