#SP0000259. Số Carmichael (Carmichael Numbers)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Số Carmichael (Carmichael Numbers)
Carmichael Numbers
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
A programmer is investigating a primality test for a cryptographic application. Fermat’s theorem says that if is prime, then for every integer .
Some composite integers nevertheless satisfy this congruence for every integer . Such integers are called Carmichael numbers.
Given a positive integer , determine whether it is a Carmichael number. Prime numbers are not Carmichael numbers even though they satisfy Fermat’s congruence.
Input
One line containing the integer .
Output
- If is a Carmichael number, print
The number n is a Carmichael number., replacingnwith the input integer. - Otherwise, print
n is normal., replacingnwith the input integer.
Letter case, spaces, and the final full stop must match exactly.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
1729
Output
The number 1729 is a Carmichael number.
Explanation
is square-free and all divide . By Korselt’s criterion, it is a Carmichael number.
Example 2
Input
17
Output
17 is normal.
Explanation
is prime. A Carmichael number must be composite, so it is normal.
Example 3
Input
561
Output
The number 561 is a Carmichael number.
Explanation
is square-free. The values all divide , so is Carmichael.
Example 4
Input
1109
Output
1109 is normal.
Explanation
has no prime divisor at most , so it is prime and therefore not a Carmichael number.