Home => ProblemSet => 4.2-24:素数环
Problem1353--4.2-24:素数环

1353: 4.2-24:素数环

Time Limit: 1 Sec  Memory Limit: 128 MB  Submit: 0  Solved: 0
[ Submit ] [ Status ] [ Creator: ][ 参考程序 ]

Description

输入一个正整数n,把整数1,2,3,...,n组成一个环,使得相邻两个整数之和均为素数,输出时从整数1开始逆时针排列。同一个环输出一次。

Input

一个整数n

Output

全部素数环,数字由小到大排列

Sample Input Copy

6

Sample Output Copy

1 4 3 2 5 6
1 6 5 2 3 4

HINT

n<=16

Source/Category