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.
First line of input contains the number of test cases.
Only line of each test case contains the number n.
Print "Yes" if the number is a Carmichael number else "No" without quotes.
8 is not a Carmichael number because 3 is relatively prime to 8 and
(38-1) % 8 = 2187 % 8 is not 1.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.