Home > Back-end >  The adjacent primes
The adjacent primes

Time:09-25

A prime number greater than 2 input, output and the prime number adjacent two prime Numbers,
Enter
Multiple sets of data of a line, each containing a prime number greater than 2,
O
Output three adjacent primes, in the middle of the prime number for input,
The sample input Copy
3
11.
Sample output Copy
2<3<5
7 & lt; 11 & lt; 13

CodePudding user response:

Simple code to write their own
Make a judge whether prime function, and then from the known this 3 or 11, respectively to the size of two direction, cycle to find prime Numbers good

Or if you know the range, such as 100, within the early put all prime number calculated in an array, and then find the same

It is not difficult, write their own code
  • Related