Submit | All submissions | Best solutions | Back to list |
APS2 - Amazing Prime Sequence (hard) |
This problem is a harder version of APS.
Let be the smallest prime factor of . For example, and .
The sequence is defined for all positive integers as follows:
- (if )
Given , find modulo .
Input
First line contains (), the number of test cases.
Each of the next lines contains a single integer . ()
Output
For each integer , output a single line containing modulo .
Example
Input: 5
1
4
100
1000000
1000000000000 Output: 0
7
1257
37568404989
7294954823202325427
Explanation for Input
-
-
Information
There are 6 Input files.
- Input #0: , , TL = 1s.
- Input #1: , , TL = 20s.
- Input #2: , , TL = 20s.
- Input #3: , , TL = 20s.
- Input #4: , , TL = 20s.
- Input #5: , , TL = 20s.
My solution runs in 5.36 sec. (total time)
Source Limit is 8 KB.
Added by: | Min_25 |
Date: | 2014-06-05 |
Time limit: | 1s-20s |
Source limit: | 8192B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU |
Resource: | APS |
hide comments
2016-04-15 05:18:17 [Rampage] Blue.Mary
The source limit and time limit are both reasonable (twice of my ugly code's source length and running time) for solving this problem. Thanks to min_25 for setting those constraints carefully. Last edit: 2016-04-15 05:19:29 |
|
2015-01-28 08:40:19 abdou_93
not (hard).for more sense (impossible) |