test post
I am writing this short post to test out MathJax equation rendering and Rouge syntax highlighting in Jekyll.
Below is some simple C++ code to generate the list of Fibonacci numbers up to and including index \(n\),
\[F_n = F_{n-1} + F_{n-2},\]with \(F_0 = 0\) and \(F_1 = 1\).
#include <iostream>
#include <vector>
int main() {
int n;
std::cout << "Enter n: ";
std::cin >> n;
std::vector<long long> fib = {0, 1};
for(int i = 2; i <= n; i++) {
fib.push_back(fib[i-1] + fib[i-2]);
}
for(int i = 0; i <= n; i++) {
std::cout << "F_" << i << " = " << fib[i] << std::endl;
}
return 0;
}
Save this as fib.cpp, then run the following command to compile it:
g++ -o fib fib.cpp
Finally, run the executable:
./fib
Sample output:
Enter n: 92
F_0 = 0
F_1 = 1
F_2 = 1
F_3 = 2
F_4 = 3
F_5 = 5
F_6 = 8
F_7 = 13
F_8 = 21
F_9 = 34
F_10 = 55
F_11 = 89
F_12 = 144
F_13 = 233
F_14 = 377
F_15 = 610
F_16 = 987
F_17 = 1597
F_18 = 2584
F_19 = 4181
F_20 = 6765
F_21 = 10946
F_22 = 17711
F_23 = 28657
F_24 = 46368
F_25 = 75025
F_26 = 121393
F_27 = 196418
F_28 = 317811
F_29 = 514229
F_30 = 832040
F_31 = 1346269
F_32 = 2178309
F_33 = 3524578
F_34 = 5702887
F_35 = 9227465
F_36 = 14930352
F_37 = 24157817
F_38 = 39088169
F_39 = 63245986
F_40 = 102334155
F_41 = 165580141
F_42 = 267914296
F_43 = 433494437
F_44 = 701408733
F_45 = 1134903170
F_46 = 1836311903
F_47 = 2971215073
F_48 = 4807526976
F_49 = 7778742049
F_50 = 12586269025
F_51 = 20365011074
F_52 = 32951280099
F_53 = 53316291173
F_54 = 86267571272
F_55 = 139583862445
F_56 = 225851433717
F_57 = 365435296162
F_58 = 591286729879
F_59 = 956722026041
F_60 = 1548008755920
F_61 = 2504730781961
F_62 = 4052739537881
F_63 = 6557470319842
F_64 = 10610209857723
F_65 = 17167680177565
F_66 = 27777890035288
F_67 = 44945570212853
F_68 = 72723460248141
F_69 = 117669030460994
F_70 = 190392490709135
F_71 = 308061521170129
F_72 = 498454011879264
F_73 = 806515533049393
F_74 = 1304969544928657
F_75 = 2111485077978050
F_76 = 3416454622906707
F_77 = 5527939700884757
F_78 = 8944394323791464
F_79 = 14472334024676221
F_80 = 23416728348467685
F_81 = 37889062373143906
F_82 = 61305790721611591
F_83 = 99194853094755497
F_84 = 160500643816367088
F_85 = 259695496911122585
F_86 = 420196140727489673
F_87 = 679891637638612258
F_88 = 1100087778366101931
F_89 = 1779979416004714189
F_90 = 2880067194370816120
F_91 = 4660046610375530309
F_92 = 7540113804746346429
Note that this fails for \(n > 92\), because the numbers become too large to be represented as a 64-bit integer.