Encryption Key
InterviewTime limit2sMemory limit128 MB
Determine for each large number S whether all its prime factors exceed one million, using trial division up to that bound.
- Level
Easy3 of 10
- Topics
- Number theory, Math, Brute force
- Solved
- No attempts yet
Problem
Many modern cryptographic systems use a number formed by multiplying very large prime numbers as an encryption key, because factoring a very large number quickly is practically hard.
In practice these primes have hundreds of thousands of digits or more, but here we work at a smaller scale: we treat any prime greater than as a "very large prime."
Given a number , write a program that decides whether it is a good encryption key at this scale. is a good encryption key if every prime factor of is greater than ; otherwise it is not.
Input
The first line contains the count of numbers, . Each of the next lines contains one number to be checked.
Output
Print lines: for each number print YES if it is a good encryption key and NO otherwise, in the order given.