Skip to content

Commit

Permalink
Added number theory
Browse files Browse the repository at this point in the history
  • Loading branch information
dothething1DA committed Oct 17, 2024
1 parent 301acde commit ecd4f50
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions content/kactl.tex
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
\kactlchapter{combinatorial}
\kactlchapter{data-structures}
\kactlchapter{graph}
\kactlchapter{number-theory}
\end{multicols*}
\end{document}
2 changes: 2 additions & 0 deletions content/number-theory/chapter.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
\chapter{number-theory}
\kactlimport{modInverse.cpp}
9 changes: 9 additions & 0 deletions content/number-theory/modInverse.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Author: me
* Description: Only works if m is prime
* Time: O(50)
*/

long long m_inv(long long a, long long m) {
return a <= 1 ? a : m - (m/a)*inv(m%a) % m;
}
Binary file added kactl.pdf
Binary file not shown.

0 comments on commit ecd4f50

Please sign in to comment.