Submit  All submissions  Best solutions  Back to list 
FIBSUM  Sum of Fibonacci numbers 
Given the ith (1<=i<=35) Fibonacci number F_{i} calculate the sum of the ith till i+9th number F_{i}+F_{i+1}+...+F_{i+9} and the last digit of the i+246th one F_{i+246}.
Be careful: Your solution mustn't exceed 111 bytes. But rather half of it should be more than enough.
Score is source length.
Input
In the first line the number of testcases N<=100, then N lines with one positive integer i.
Output
One line with "F_{i}+F_{i+1}+...+F_{i+9}+last digit of F_{i+246}" for each i.
Example
Input: 2
1
35 Output: 146
1821381552
Added by:  HWK 
Date:  20110325 
Time limit:  0.176s 
Source limit:  111B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: SCM qobi 
hide comments


20140519 11:20:40 Dominique VAILLANT
@Mitch: Up to now I thought to know very well Ruby, but... top world Mitch arrived! 

20131202 20:09:21 challenger
It's not my merit as I only shorten your codes by comparing them with each other. ;) 

20131202 19:42:51 ওয়াসী (Wasi)
@challenger Wow! piotr you are incredible. It was tough to reach 41 byte. Will try again :) Edit: Congratz! for the 32B awk solution(FIBON) too :D Last edit: 20131202 20:07:49 

20131130 17:27:57 challenger
@ওয়াসী (Wasi)  How about now? ;> 

20130906 18:56:32 challenger
@ওয়াসী (Wasi)  Well done again. Congrats for not giving up. :) 

20130906 14:09:45 ওয়াসী (Wasi)
@challenger have a look at that. 41B in AWK! :D Last edit: 20130906 14:49:32 

20130710 15:22:45 Jander
@[]{}  It says right at the start of the description "Given the ith (1<=i<=35) Fibonacci". 

20130709 07:31:17 orange
what is max limit for i?? 

20120226 02:36:32 Hallvard Norheim Bø
My Java solution is 208 bytes :( Last edit: 20120228 01:15:58 

20110408 11:42:26 HWK
@Piotr Kakol: You're right. @Nabb: Try also http://www.spoj.pl/SHORTEN/problems/MERTENS/. 