Submit | All submissions | Best solutions | Back to list |
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.
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 |
hide comments
2016-06-16 01:08:49 Francky
My kind of problem ! Many thanks for this task ;-) (Re) Thanks ! =(Francky)=> I let a very small place to allow someone to take #1, it's possible but could be hard. edit : no more place. Or using a slow language. Last edit: 2017-02-10 17:50:55 |
|
2016-05-04 03:05:41 Min_25
@Blue.Mary Thank you. I also like the amazing property of this sequence. |
|
2016-05-03 16:54:36 [Rampage] Blue.Mary
Thanks to min_25 for setting this beautiful and tough problem. Learned some new things. |