MeetCode
Check Semiprime
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Run
Submit
Dark
Problem Statement
Solutions
Submissions
Check Semiprime
Hard
Computer Mathematics
Primes & Factorization
35 views
Explanation
Complexity
Problem Statement
A semiprime has exactly two prime factors (counted with multiplicity). Print YES/NO.
Input Format
One integer n.
Output Format
YES or NO.
Example
Input
21
Output
YES
Constraints
2
Input / Output Format
Input Format
One integer n.
Output Format
YES or NO.
Constraints
2
Examples
Input:
21
Output:
YES
Example Solution (Public)
Computer Mathematics
Factor n and count total prime factors with multiplicity. YES if count==2.
Official Solution Code
Wrap
Copy
Factor n and count total prime factors with multiplicity. YES if count==2.
Please
login
to submit solutions.
Editor
C
C++
Computer Mathematics
CSS
DSA
HTML
Java
JavaScript
NodeJS
PHP
Programming Interview
Python
ReactJS
SQL
Test Cases
Output
Submission Result
Input
21
Expected Output
YES
Compile Output
Error
Output
Please
login
to submit solutions.