{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eThe branch of mathematics called number theory is about properties of numbers. \n One of the areas that has captured the interest of number theoreticians for \n thousands of years is the question of primality. A prime number is a number \n that is has no proper factors (it is only evenly divisible by 1 and itself). \n The first prime numbers are 2,3,5,7 but they quickly become less frequent. One \n of the interesting questions is how dense they are in various ranges. Adjacent \n primes are two numbers that are both primes, but there are no other prime numbers \n between the adjacent primes. For example, 2,3 are the only adjacent primes that \n are also adjacent numbers. \u003c/p\u003e\n\u003cp\u003e Your program is given 2 numbers: L and U (1 \u0026lt;\u003d L \u0026lt; U \u0026lt;\u003d 2,147,483,647), \n and you are to find the two adjacent primes C1 and C2 (L \u0026lt;\u003d C1 \u0026lt; C2 \u0026lt;\u003d \n U) that are closest (i.e. C2-C1 is the minimum). If there are other pairs that \n are the same distance apart, use the first pair. You are also to find the two \n adjacent primes D1 and D2 (L \u0026lt;\u003d D1 \u0026lt; D2 \u0026lt;\u003d U) where D1 and D2 are as \n distant from each other as possible (again choosing the first pair if there \n is a tie). \u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eInput\u003c/b\u003e\u003cbr\u003e\n \u003cbr\u003e\n Each line of input will contain two positive integers, L and U, with L \u0026lt; \n U. The difference between L and U will not exceed 1,000,000. \u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eOutput\u003cbr\u003e\n \u003c/b\u003e\u003cbr\u003e\n For each L and U, the output will either be the statement that there are no \n adjacent primes (because there are less than two primes between the two given \n numbers) or a line giving the two pairs of adjacent primes. \u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eSample Input\u003c/b\u003e\u003cbr\u003e\n \u003cbr\u003e\n 2 17\u003cbr\u003e\n 14 17\u003c/p\u003e\n\u003cp\u003e\u003cbr\u003e\n \u003cb\u003eSample Output\u003c/b\u003e\u003cbr\u003e\n \u003cbr\u003e\n 2,3 are closest, 7,11 are most distant.\u003cbr\u003e\n There are no adjacent primes.\u003cbr\u003e\n\u003c/p\u003e\n"}}]}