HC10000 - Hofstadter–Conway 10000 dollar sequence
Hofstadter–Conway $10,000 sequence is a famous sequence, which is defined as
Your task is to find a summatory function and compute modulo .
Input
The first line contains (), the number of test cases.
Each of the next lines contains a positive integer ().
Output
For each test case, print modulo .
Example
Input: 10 1 2 3 4 5 10 100 1000 1000000 1000000000 Output: 1 2 4 6 9 32 2818 269446 334706485 137951847
Explanation
You can verify that , and . So, .
.
Information
There are 5 input files:
- #1: , TL = 2s.
- #2: , TL = 2s.
- #3: , TL = 3s.
- #4: , TL = 5s.
- #5: , TL = 12s.
These time limits allow a (slow) Python2 solution to get accepted.
hide comments
|
Francky:
2016-06-16 01:08:49
My kind of problem ! Many thanks for this task ;-)
|
|
Min_25:
2016-05-04 03:05:41
@Blue.Mary
|
|
[Rampage] Blue.Mary:
2016-05-03 16:54:36
Thanks to min_25 for setting this beautiful and tough problem. Learned some new things. |
Added by: | Min_25 |
Date: | 2016-05-03 |
Time limit: | 2s-12s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |