Skip to content

Commit

Permalink
Added mobius inversion (kth-competitive-programming#169)
Browse files Browse the repository at this point in the history
* added mobius inversion

* Added floor formula
  • Loading branch information
Chillee authored Apr 23, 2020
1 parent 91b3145 commit 1e6e8b0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions content/number-theory/chapter.tex
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,17 @@ \section{Estimates}
$\sum_{d|n} d = O(n \log \log n)$.

The number of divisors of $n$ is at most around 100 for $n < 5e4$, 500 for $n < 1e7$, 2000 for $n < 1e10$, 200\,000 for $n < 1e19$.

\section{Mobius Function}
\[
\mu(n) = \begin{cases} 0 & n \textrm{ is not square free}\\ 1 & n \textrm{ has even number of prime factors}\\ -1 & n \textrm{ has odd number of prime factors}\\\end{cases}
\]
Mobius Inversion:
\[ g(n) = \sum_{d|n} f(d) \Leftrightarrow f(n) = \sum_{d|n} \mu(d)g(n/d) \]
Other useful formulas/forms:

$ \sum_{d | n} \mu(d) = [ n = 1] $ (very useful)

$ g(n) = \sum_{n|d} f(d) \Leftrightarrow f(n) = \sum_{n|d} \mu(d/n)g(d)$

$ g(n) = \sum_{1 \leq m \leq n} f(\left\lfloor\frac{n}{m}\right \rfloor ) \Leftrightarrow f(n) = \sum_{1\leq m\leq n} \mu(m)g(\left\lfloor\frac{n}{m}\right\rfloor)$

0 comments on commit 1e6e8b0

Please sign in to comment.