{"trustable":false,"sections":[{"title":"Sample Output","value":{"format":"MD","content":" An important topic nowadays in computer science is cryptography. Some people even think that cryptography is the only important field in computer science, and that life would not matter at all without cryptography.\n\n Alvaro is one of such persons, and is designing a set of cryptographic procedures for cooking paella. ´\nSome of the cryptographic algorithms he is implementing make use of big prime numbers. However,\nchecking if a big number is prime is not so easy. An exhaustive approach can require the division of the\nnumber by all the prime numbers smaller or equal than its square root. For big numbers, the amount\nof time and storage needed for such operations would certainly ruin the paella.\n\n However, some probabilistic tests exist that offer high confidence at low cost. One of them is the\nFermat test.\n\n Let a be a random number between 2 and n−1 (being n the number whose primality we are testing).\nThen, n is probably prime if the following equation holds:\n\na\u003csup\u003en\u003c/sup\u003e mod n \u003d a\n\n If a number passes the Fermat test several times then it is prime with a high probability.\n\n Unfortunately, there are bad news. Some numbers that are not prime still pass the Fermat test\nwith every number smaller than themselves. These numbers are called Carmichael numbers.\n\n In this problem you are asked to write a program to test if a given number is a Carmichael number.\nHopefully, the teams that fulfill the task will one day be able to taste a delicious portion of encrypted\npaella. As a side note, we need to mention that, according to Alvaro, the main advantage of encrypted ´\npaella over conventional paella is that nobody but you knows what you are eating.\n\nInput\nThe input will consist of a series of lines, each containing a small positive number n (2 \u003c n \u003c 65000).\nA number n \u003d 0 will mark the end of the input, and must not be processed.\n\nOutput\nFor each number in the input, you have to print if it is a Carmichael number or not, as shown in the\nsample output.\n\nSample Input\n1729\n17\n561\n1109\n431\n0\n\nSample Output\nThe number 1729 is a Carmichael number.\n17 is normal.\nThe number 561 is a Carmichael number.\n1109 is normal.\n431 is normal.\n\n\n\n```c\nimport java.util.Scanner;\n\npublic class Main {\n static boolean[] is_prime \u003d new boolean[65005];\n static int[] prime \u003d new int[65005];\n\n public static void main(String[] args) {\n sieve(65000);\n Scanner cin \u003d new Scanner(System.in);\n while (cin.hasNext()) {\n boolean flag \u003d true;\n int n \u003d cin.nextInt();\n if (n \u003d\u003d 0)\n return;\n if (is_prime[n])\n System.out.println(n + \" is normal.\");\n else {\n for (int i \u003d 1; i \u003c n; i++) {\n if (mod_pow(i, n, n) !\u003d i) {\n flag \u003d false;\n System.out.println(n + \" is normal.\");\n break;\n }\n }\n if (flag)\n System.out.println(\"The number \" + n + \" is a Carmichael number.\");\n }\n }\n }\n\n static void sieve(int n) {\n int p \u003d 0;\n for (int i \u003d 2; i \u003c\u003d n; i++)\n is_prime[i] \u003d true;\n for (int i \u003d 2; i \u003c\u003d n; i++)\n if (is_prime[i]) {\n prime[p++] \u003d i;\n for (int j \u003d 2 * i; j \u003c\u003d n; j +\u003d i)\n is_prime[j] \u003d false;\n }\n }\n\n static long mod_pow(long x, long n, long mod) {\n long res \u003d 1;\n while (n \u003e 0) {\n if ((n \u0026 1) \u003d\u003d 1) // 如果二进制最低位为1\n res \u003d res * x % mod; // 乘上x^(2^i)\n x \u003d x * x % mod; // 将x平方\n n \u003e\u003e\u003d 1;\n }\n return res;\n }\n}\n```\n\n“到此一游”般拙劣的恶作剧(代码也是copy的)"}}]}