BETA

Difficulty Level: Medium

Total Submissions: 268 Accuracy:

12.31%

Carmichael Numbers
     

A number n is said to be a Carmichael number if it satisfies the following modular arithmetic condition:

  power(b, n-1) MOD n = 1, 
  for all b ranging from 1 to n such that b and 
  n are relatively prime, i.e, gcd(b, n) = 1 

Given a positive integer n, find if it is a Carmichael number.

Input:

First line of input contains the number of test cases.

Only line of each test case contains the number n.


Output:
Print "Yes" if the number is a Carmichael number else "No" without quotes.

Constraints:

1<=T<=100

1<=N<=100000


Example:

Sample Input:

1
8

Sample Output:
No

Explanation :
8 is not a Carmichael number because 3 is relatively prime to 8 and

(38-1) % 8 = 2187 % 8 is not 1.

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: jain_rishabh

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.