Welcome to ZOJ
Information
Problems
Runs
Statistics
Ranklist
Clarification
64 - The 8th Zhejiang University Programming Contest - 1006
Find All M^N Please

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Recently, Joey has special interest in the positive numbers that could be represented as M ^ N (M to the power N), where M and N are both positive integers greater than or equal to 2. For example, 4, 8, 9 and 16 are first four such numbers, as 4 = 2 ^ 2, 8 = 2 ^ 3, 9 = 3 ^ 2, 16 = 2 ^ 4. You are planning to give Joey a surprise by giving him all such numbers less than 2 ^ 31 (2147483648). List them in ascending order, one per line.

Sample Output

4
8
9
16
25
27
32
|
| <-- a lot more numbers
|
1024
1089
1156
1225
1296
1331
|
|
|


Submit    Status