fork(2) download
  1. unsigned long long fibonacci(unsigned long long Solve)
  2. {
  3. if (Solve<=1) return 1;
  4. unsigned long long Even = 0;
  5. unsigned long long Odd = 1;
  6. unsigned long long Loops = (Solve-2)/16+1;
  7. switch (Solve%16/2) {
  8. do {
  9. case 0: Even+=Odd; Odd+=Even;
  10. case 7: Even+=Odd; Odd+=Even;
  11. case 6: Even+=Odd; Odd+=Even;
  12. case 5: Even+=Odd; Odd+=Even;
  13. case 4: Even+=Odd; Odd+=Even;
  14. case 3: Even+=Odd; Odd+=Even;
  15. case 2: Even+=Odd; Odd+=Even;
  16. case 1: Even+=Odd; Odd+=Even;
  17. }while(--Loops);
  18. };
  19. return (Solve&1 ? Odd+Even : Odd);
  20. }
  21.  
  22. #include <iostream>
  23. int main() {
  24. for(unsigned long long i=0; i<93; ++i)
  25. std::cout << i << '=' << fibonacci(i) << '\n';
  26. }
Success #stdin #stdout 0s 2928KB
stdin
Standard input is empty
stdout
0=1
1=1
2=2
3=3
4=5
5=8
6=13
7=21
8=34
9=55
10=89
11=144
12=233
13=377
14=610
15=987
16=1597
17=2584
18=4181
19=6765
20=10946
21=17711
22=28657
23=46368
24=75025
25=121393
26=196418
27=317811
28=514229
29=832040
30=1346269
31=2178309
32=3524578
33=5702887
34=9227465
35=14930352
36=24157817
37=39088169
38=63245986
39=102334155
40=165580141
41=267914296
42=433494437
43=701408733
44=1134903170
45=1836311903
46=2971215073
47=4807526976
48=7778742049
49=12586269025
50=20365011074
51=32951280099
52=53316291173
53=86267571272
54=139583862445
55=225851433717
56=365435296162
57=591286729879
58=956722026041
59=1548008755920
60=2504730781961
61=4052739537881
62=6557470319842
63=10610209857723
64=17167680177565
65=27777890035288
66=44945570212853
67=72723460248141
68=117669030460994
69=190392490709135
70=308061521170129
71=498454011879264
72=806515533049393
73=1304969544928657
74=2111485077978050
75=3416454622906707
76=5527939700884757
77=8944394323791464
78=14472334024676221
79=23416728348467685
80=37889062373143906
81=61305790721611591
82=99194853094755497
83=160500643816367088
84=259695496911122585
85=420196140727489673
86=679891637638612258
87=1100087778366101931
88=1779979416004714189
89=2880067194370816120
90=4660046610375530309
91=7540113804746346429
92=12200160415121876738