Mathematical preliminaries

Logarithms

  • Logarithmic algorithms, sweet!

    Floor and ceiling

    The floor of $x$ (written as $\lfloor x \rfloor$) takes real value $x$ and returns the greatest integer $\le x$; the ceiling of $x$ (written as $\lceil x \rceil$) takes real value $x$ and returns the least integer $\ge x$

    Modulus

    The modulus (or mod) function returns the remainder of an integer division; written as $n \% m $.

    Summations

    Useful summations that have closed-form solutions.
    $\sum\limits_{i=1}^n i = \frac{n(n + 1)}{2}$
    $\sum\limits_{i=1}^n i^2 = \frac{2n^3 + 3n^2 + 1}{6} = \frac{n(2n+1)(n+1)}{6}$
    $\sum\limits_{i=1}^{logn} n = n logn$
    $\sum\limits_{i=1}^n \frac{1}{2^i} = 1 - \frac{1}{2^n}$
    $\sum\limits_{i=0}^{n}2^i = 2^{n+1} - 1$
    $\sum\limits_{i=1}^{n}\frac{i}{2^i} = 2 - \frac{n + 2}{2^n}$