Search⌘ K

Solved Problem - Check Prime

Understand how to check primality for multiple test cases efficiently by iterating only up to the square root of the number. This lesson guides you through problem-solving strategies and improves your number theory skills essential for competitive programming.

We'll cover the following...

Problem statement

Given a number, NN, check if it’s prime or not. Do this for TT test cases.

Input format

The first line contains a positive integer TT (1T103)(1 \leq T \leq 10^3) ...