I am very confused by this statement "There exists some composite numbers with the property that for every $1<a < n,$ $$a^{n-1} \equiv 1 \pmod n.$$ Such numbers are called Carmichael numbers." First few examples of Carmichael numbers are $561,1105,1729\cdots.$ But I found that when $n=561 $there is $a=399$,when $n=1105$ there is $a=312$ and when $n=1729$ there is $a=462$ such that above property fails. Please explain this to me I am new to number theory.
-
2see here https://en.wikipedia.org/wiki/Carmichael_number – Dr. Sonnhard Graubner Jan 13 '18 at 18:59
-
Have a look at the "Related Questions" at the right margin. – Dietrich Burde Jan 13 '18 at 19:02
-
2Is there something you wanted to know that can't be immediately revealed by a Google search? – Qudit Jan 13 '18 at 19:03
-
1$\gcd(399,561)=3,$ so the numbers are not relative prime. – gammatester Jan 13 '18 at 19:03
-
This means Primality Test done using Fermat method will identify these number as composite.@gammatester – CJ Koirala Jan 13 '18 at 19:06
-
But when n=561 there is a=399 such that a^(n−1)≡1(modn) does not hold so n=561 is composite number. So, it does not fails for 561 which is Carmichael number. – CJ Koirala Jan 13 '18 at 19:09
-
1The Fermat test should be done with $\gcd(a,n)=1$, othwerwise you definitely know that $n$ is composite. – gammatester Jan 13 '18 at 19:14
2 Answers
The correct definition is that a composite number $n$ is Carmichael if $a^{n-1}\equiv 1\pmod{n}$ whenever $a$ is relatively prime to $n$, not for all $1<a<n$.
If $a^{n-1}\equiv 1\pmod{n}$ for all $1<a<n$, that actually implies that $n$ is prime, since $a^{n-1}\equiv 1\pmod{n}$ implies $a$ is relatively prime to $n$ so no such $a$ is a factor of $n$.
- 342,377
-
My question is does this algorithm ,If n is a prime number, then for every a, 1 <= a < n, a^(n-1) ≡ 1 (mod n) test done for all vales of a, will not fail to identify Carmichael number as composite number. – CJ Koirala Jan 13 '18 at 19:39
For verifying $n=561$ see here:
For the definition, note that $n=561$ and $a=399$ are not relatively prime. Also $1105$ and $312$ are not relatively prime, and so on. But you need that $n$ and $a$ are coprime!
- 140,055
-
This means if I use this algorithm,If n is a prime number, then for every a, 1 <= a < n,
a^(n-1) ≡ 1 (mod n) for primality test than this algorithm will not fail for Carmichael numbers. As Carmichael are composite number and gcd of such number with a, such that 1<=a<n will be greater than one for at least one number a,thus failing to pass the test for primality.
– CJ Koirala Jan 13 '18 at 19:21