Skip to content

Commit

Permalink
Fix small mistakes discovered in Unit 24
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Lecomte committed Apr 16, 2016
1 parent f3e6d86 commit fcab0f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 24-number-theory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This unit covers aspects of number theory that are useful in programming contest
## Practice problems

### Easy
- UVa 544 - [Goldbach's Conjecture](https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=484) (sieve)
- UVa 543 - [Goldbach's Conjecture](https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=484) (sieve)
- UVa 583 - [Prime factors](https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=524) (sieve + factorization)
- UVa 11827 - [Maximum GCD](https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2927)
- UVa 10104 - [Euclid Problem](https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1045) (extended Euclid)
Expand Down
Binary file modified 24-number-theory/number-theory.pdf
Binary file not shown.
8 changes: 4 additions & 4 deletions 24-number-theory/number-theory.tex
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ \section{Sieve of Eratosthenes}
\item Complexity is $O(\sqrt{n}\,/\log n)$ because the density of primes is proportional to $1\,/ \log n$
\end{itemize}
\begin{lstlisting}
// Only called for n < MAXN*MAXN
// Only called for n < (last prime)^2
bool isPrime(int n)
{
if (n < MAXN)
return bs[n];
for (int i : primes)
if (n % i == 0)
for (int i=0; primes[i]*primes[i] <= n; i++)
if (n % primes[i] == 0)
return false;
return true;
}
Expand Down Expand Up @@ -333,7 +333,7 @@ \section{Extended Euclid}
\item First solution: $x=1, y=-1$
\item Formula: $(x+2n,\ y-3n)$
\item Positive $n$: $(3,-4), (5,-7), (7,-10) \ldots$
\item Negative $n$: $(-1, 2), (-3, 5), (-5, 8) \ldots$
\item Negative $n$: $(-1, 3), (-3, 5), (-5, 8) \ldots$
\end{itemize}
\end{frame}

Expand Down

0 comments on commit fcab0f8

Please sign in to comment.