LaTeX, Maths, and Code
5 August, 2020
This blog supports code syntax highlighting through prism-react-renderer
and the usage of via gatsby-remark-katex
However (the library used to render) will crash your development environment if it encounters a symbol it is unfamiliar with. Make sure you test your posts locally before publishing the site to a production server.
To learn more about implementing in markdown, check out the documentation here
Examples
Consider the following list of k a's and l b's:
Look further at this wild equation:
Code Examples
Quotient and remainder of a pair of numbers in c++
#include <iostream>
using namespace std;
int main()
{
int divisor, dividend, quotient, remainder;
cout << "Enter dividend: ";
cin >> dividend;
cout << "Enter divisor: ";
cin >> divisor;
quotient = dividend / divisor;
remainder = dividend % divisor;
cout << "Quotient = " << quotient << endl;
cout << "Remainder = " << remainder;
return 0;
}
Sieve of Eratosthenes implemented in Python
def countPrimes_sieve_of_eratosthenes(self, n: int) -> int:
if n < 2:
return 0
marked = set()
seive = [i for i in range(1, n)]
skip = 2
while skip * skip < n:
if skip not in marked:
marked.update(seive[2 * skip - 1 :: skip])
skip += 1
return len(seive) - len(marked) - 1
Thanks to kunalJa for the examples on this page
↑