โ† HCLTech questions
CodingReported in a candidate post, Aug 2022

Check if number is prime or return lowest divisor

Filed under HCLTech

The question

Write a function to check if a given number is prime. Return 1 if it is prime, otherwise return its smallest divisor.

No write-up yet. Related questions below have one.

Related HCLTech questions

Collected from public candidate posts and coding forums. Updated Nov 2026.