Cleaned up problem library

This commit is contained in:
Mark 2023-05-17 14:14:37 -07:00
parent 0a6fefce9f
commit 019ede191a
4 changed files with 154 additions and 80 deletions

View File

@ -4,34 +4,74 @@
]{../resources/ormc_handout} ]{../resources/ormc_handout}
\def\stars#1{
\count255=1
\ifnum #1 > 0
\loop
{\color{cyan!50!gray} \bigstar}%
\ifnum\count255 < #1
\advance\count255 by 1
\repeat
\else%
{\color{cyan!50!gray} \bigstar}%
\fi%
%
\ifnum \count255 < 5
\loop
{\color{gray} \bigstar}%
\ifnum\count255 < 4
\advance\count255 by 1
\repeat
\fi
}
\NewDocumentCommand{\p}{ m m }{ \NewDocumentCommand{\p}{ m m }{
\textbf{#1 #2:} \par \begin{minipage}{\textwidth}
{\color{gray}Difficulty:} {\color{cyan!50!gray} \bigstar \bigstar \bigstar}{\color{gray} \bigstar \bigstar} \textbf{#1 #2:} \par
\vspace{3mm} \ifdifficulty{#1}{#2}{{\color{gray}Difficulty:} \stars{\getdifficulty{#1}{#2}}}
\getproblem{#1}{#2} \vspace{2mm}
\vspace{2mm} \getproblem{#1}{#2}
\ifsolution{#1}{#2}{}[
\ifanswer{#1}{#2}{%
\vspace{2mm}%
{\color{red}\textbf{Solution:}} \getanswer{#1}{#2}
}
]
\end{minipage}
\ifsolution{#1}{#2}{ \ifsolution{#1}{#2}{
\begin{solution} \begin{solution}
\getsolution{#1}{#2} \getsolution{#1}{#2}
\end{solution} \end{solution}
}[ }
\ifanswer{#1}{#2}{%
\vspace{2mm}%
{\color{red}\textbf{Solution:}} \getanswer{#1}{#2}
}
]
\vspace{20mm} \penalty-500
\vspace{15mm}
\vfill \vfill
} }
\input{problem} \newcommand{\postproblem}[2]{
\ifcsname#1:all\endcsname
\expandafter\edef\csname#1:all\endcsname{\csname#1:all\endcsname \p{#1}{#2}}
\else
\expandafter\gdef\csname#1:all\endcsname{\p{#1}{#2}}
\fi
}
\usepackage{problemlib}
\input{problems/numbertheory}
\input{problems/algebra}
\input{problems/combinatorics}
\input{problems/pidgeonhole}
\input{problems/misc}
%\makeatletter %\makeatletter
%\newcommand{\shoppinglist}[1]{Shopping list: #1\checknextarg} %\newcommand{\shoppinglist}[1]{Shopping list: #1\checknextarg}
@ -40,7 +80,6 @@
%\makeatother %\makeatother
\newcommand{\q}[1]{ \newcommand{\q}[1]{
\section{#1} \section{#1}
\csname#1:all\endcsname \csname#1:all\endcsname
@ -53,7 +92,7 @@
{Mark's Problem Library} {Mark's Problem Library}
{ {
This document lists all problems in this library. \\ This document lists all problems in this library. \\
Use it to find problems or debug \LaTeX{}. Use it to find problems or debug the source.
} }
@ -61,4 +100,5 @@
\q{Combinatorics} \q{Combinatorics}
\q{NumberTheory} \q{NumberTheory}
\q{Pidgeonhole} \q{Pidgeonhole}
\q{Misc}
\end{document} \end{document}

View File

@ -1,8 +1,12 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{problemlib}[2023/05/17 ORMC Problem Library]
% Defines a new problem. % Defines a new problem.
% See problem definition files for usage examples. % See problem definition files for usage examples.
\long\def\problemdef#1#2#3{ \long\def\problemdef#1#2#3{
\ifcsname#1:problem:#2\endcsname \ifcsname#1:problem:#2\endcsname
\PackageError{Problem Sets}{Problem #1:#2 is already defined}{} \PackageError{problemlib}{Problem #1:#2 is already defined}{}
\fi \fi
% Use a group to limit scope of special commands. % Use a group to limit scope of special commands.
@ -32,12 +36,10 @@
\endgroup \endgroup
\ifcsname#1:all\endcsname % Optional hook to run after each problem definition.
\expandafter\edef\csname#1:all\endcsname{\csname#1:all\endcsname \p{#1}{#2}} % Must be defined BEFORE problems are included.
\else \ifdefined\postproblem
\expandafter\gdef\csname#1:all\endcsname{ \postproblem{#1}{#2}
\p{#1}{#2}
}
\fi \fi
} }
@ -50,7 +52,7 @@
\ifcsname#1:#3:#2\endcsname% \ifcsname#1:#3:#2\endcsname%
\csname#1:#3:#2\endcsname% \csname#1:#3:#2\endcsname%
\else% \else%
\PackageError{Problem Sets}{Problem #1:#2 is not defined}{} \PackageError{problemlib}{Problem #1:#2 is not defined}{}
\fi% \fi%
} }
\NewDocumentCommand{\getdifficulty}{ m m }{\get{#1}{#2}{difficulty}} \NewDocumentCommand{\getdifficulty}{ m m }{\get{#1}{#2}{difficulty}}
@ -59,34 +61,25 @@
% #1: Category % #1: Category
% #2: Problem id % #2: Problem id
% #3: Show if this problem has an answer % #3: attribute to check
% #4: Show if this problem doesn't have an answer % #4: Show if true
\NewDocumentCommand{\ifanswer}{ m m m d[] }{% % #5: Show if false
\ifcsname#1:answer:#2\endcsname% \NewDocumentCommand{\ifattribute}{ m m m m d[] }{%
#3% \ifcsname#1:#3:#2\endcsname#4%
\else% \else%
\IfNoValueF{#4}{#4}% \IfNoValueF{#5}{#5}%
\fi%
}
\NewDocumentCommand{\ifsolution}{ m m m d[] }{
\ifcsname#1:solution:#2\endcsname%
#3%
\else%
\IfNoValueF{#4}{#4}%
\fi% \fi%
} }
\NewDocumentCommand{\ifanswer}{ m m m d[] }{\ifattribute{#1}{#2}{answer}{#3}[#4]}
\NewDocumentCommand{\ifsolution}{ m m m d[] }{\ifattribute{#1}{#2}{solution}{#3}[#4]}
\NewDocumentCommand{\ifdifficulty}{ m m m d[] }{\ifattribute{#1}{#2}{difficulty}{#3}[#4]}
\NewDocumentCommand{\getanswer}{ m m }{% \NewDocumentCommand{\getanswer}{ m m }{%
\ifanswer{#1}{#2}{\get{#1}{#2}{answer}}% \ifanswer{#1}{#2}{\get{#1}{#2}{answer}}%
[\PackageError{Problem Sets}{Problem #1:#2 has no answer}{}]% [\PackageError{problemlib}{Problem #1:#2 has no answer}{}]%
} }
\NewDocumentCommand{\getsolution}{ m m }{ \NewDocumentCommand{\getsolution}{ m m }{
\ifsolution{#1}{#2}{\get{#1}{#2}{solution}}% \ifsolution{#1}{#2}{\get{#1}{#2}{solution}}%
[\PackageError{Problem Sets}{Problem #1:#2 has no solution}{}]% [\PackageError{problemlib}{Problem #1:#2 has no solution}{}]%
} }
\input{problems/numbertheory}
\input{problems/algebra}
\input{problems/combinatorics}
\input{problems/pidgeonhole}

View File

@ -1,43 +1,62 @@
\problem{} \problemdef{Misc}{1}{
A carpenter cut a chessboard into $1 \times 1$ squares in 70 minutes. \\ \difficulty{1}
How long will it take him to cut it into $2 \times 2$ squares? \\
\begin{solution} \statement{
30 A carpenter cut a chessboard into $1 \times 1$ squares in 70 minutes. \par
\end{solution} How long will it take him to cut it into $2 \times 2$ squares?
}
\problem{} \answer{30}
There are two kinds of books on a shelf: those on permissible magic and those on black magic. Two books on permissible magic cannot be set between exactly three other books, and two books on black magic may not stand next to each other. \\ }
What is the maximal amount of books that may be placed on the shelf?
\begin{solution}
8
\end{solution}
\problem{} \problemdef{Misc}{2}{
The numbers $1 ... 9$ are arranged in a $3 \times 3$ grid. \\ \difficulty{2}
The sum of each row and column is then computed. \\
What is the maximum number of consecutive integers one may find in the set of these sums?
\begin{solution}
5
\end{solution}
\problem{} \statement{
16 rugby teams participate in a regional championship. Each pair of teams plays against each other twice. The 8 teams with the most wins will proceed to the national championship. If there is a tie in this ranking, the tied teams will draw lots. \\ There are two kinds of books on a shelf: those on permissible magic and those on black magic. Two books on permissible magic cannot be set between exactly three other books, and two books on black magic may not stand next to each other. \par
Assume a rugby game can never tie. What is the minimum number of wins a team needs to guarantee a spot in the nationals? What is the maximal amount of books that may be placed on the shelf?
}
\begin{solution} \answer{8}
23 }
\end{solution}
\problem{} \problemdef{Misc}{3}{
Five boxes are filled with pastries. We know that box C contains a third of the pastries in E, and that B contains two times more than C and E combined. A contains half the number of pastries in E, and a tenth of those in D. Box B contains four times more pastries than D. \\ \difficulty{3}
What is the minimal possible positive number of pastries in all the boxes put together?
\begin{solution} \statement{
310 The numbers $1 ... 9$ are arranged in a $3 \times 3$ grid. \par
\end{solution} The sum of each row and column is then computed. \par
What is the maximum number of consecutive integers one may find in the set of these sums?
}
\answer{5}
}
\problemdef{Misc}{4}{
\difficulty{4}
\statement{
16 rugby teams participate in a regional championship. Each pair of teams plays against each other twice. The 8 teams with the most wins will proceed to the national championship. If there is a tie in this ranking, the tied teams will draw lots. \par
Assume a rugby game can never tie. What is the minimum number of wins a team needs to guarantee a spot in the nationals?
}
\answer{23}
}
\problemdef{Misc}{5}{
\difficulty{5}
\statement{
Five boxes are filled with pastries. We know that box C contains a third of the pastries in E, and that B contains two times more than C and E combined. A contains half the number of pastries in E, and a tenth of those in D. Box B contains four times more pastries than D. \par
What is the minimal possible positive number of pastries in all the boxes put together?
}
\answer{310}
}

View File

@ -1,4 +1,5 @@
\problemdef{Pidgeonhole}{1}{ \problemdef{Pidgeonhole}{1}{
\difficulty{1}
\statement{ \statement{
Is it possible to cover an equilateral triangle with two smaller equilateral triangles? Why or why not? Is it possible to cover an equilateral triangle with two smaller equilateral triangles? Why or why not?
@ -15,13 +16,13 @@
\problemdef{Pidgeonhole}{2}{ \problemdef{Pidgeonhole}{2}{
\difficulty{3}
\statement{ \statement{
You are given $n + 1$ integers. \par You are given $n + 1$ integers. \par
Prove that at least two of them have a difference divisible by $n$. Prove that at least two of them have a difference divisible by $n$.
} }
\answer{}
\solution{ \solution{
$n~|~(a-b) \iff a \equiv b \pmod{n}$ \par $n~|~(a-b) \iff a \equiv b \pmod{n}$ \par
@ -37,6 +38,7 @@
\problemdef{Pidgeonhole}{3}{ \problemdef{Pidgeonhole}{3}{
\difficulty{1}
\statement{ \statement{
You have an $8 \times 8$ chess board with two opposing corner squares cut off. You also have a set of dominoes, each of which is the size of two squares. Is it possible to completely cover the the board with dominos, so that none overlap nor stick out? You have an $8 \times 8$ chess board with two opposing corner squares cut off. You also have a set of dominoes, each of which is the size of two squares. Is it possible to completely cover the the board with dominos, so that none overlap nor stick out?
@ -52,6 +54,7 @@
} }
\problemdef{Pidgeonhole}{4}{ \problemdef{Pidgeonhole}{4}{
\difficulty{2}
\statement{ \statement{
The ocean covers more than a half of the Earth's surface. Prove that the ocean has at least one pair of antipodal points. The ocean covers more than a half of the Earth's surface. Prove that the ocean has at least one pair of antipodal points.
@ -66,6 +69,7 @@
\problemdef{Pidgeonhole}{5}{ \problemdef{Pidgeonhole}{5}{
\difficulty{2}
\statement{ \statement{
There are $n > 1$ people at a party. Prove that among them there are at least two people who have the same number of acquaintances at the gathering. (We assume that if A knows B, then B also knows A) There are $n > 1$ people at a party. Prove that among them there are at least two people who have the same number of acquaintances at the gathering. (We assume that if A knows B, then B also knows A)
@ -81,6 +85,7 @@
\problemdef{Pidgeonhole}{6}{ \problemdef{Pidgeonhole}{6}{
\difficulty{3}
\statement{ \statement{
Pick five points in $\mathbb{R}^2$ with integral coordinates. Show that two of these form a line segment that has an integral midpoint. Pick five points in $\mathbb{R}^2$ with integral coordinates. Show that two of these form a line segment that has an integral midpoint.
@ -99,6 +104,7 @@
\problemdef{Pidgeonhole}{7}{ \problemdef{Pidgeonhole}{7}{
\difficulty{2}
\statement{ \statement{
Every point on a line is painted black or white. Show that there exist three points of the same color where one is the midpoint of the line segment formed by the other two. Every point on a line is painted black or white. Show that there exist three points of the same color where one is the midpoint of the line segment formed by the other two.
@ -169,6 +175,7 @@
} }
\problemdef{Pidgeonhole}{8}{ \problemdef{Pidgeonhole}{8}{
\difficulty{1}
\statement{ \statement{
Every point on a plane is painted black or white. Show that there exist two points in the plane that have the same color and are located exactly one foot away from each other. Every point on a plane is painted black or white. Show that there exist two points in the plane that have the same color and are located exactly one foot away from each other.
@ -178,17 +185,18 @@
} }
\problemdef{Pidgeonhole}{9}{ \problemdef{Pidgeonhole}{9}{
\difficulty{2}
\statement{ \statement{
Each point on a circle is colored either black or white. Prove that there exist three equally spaced points of the same color. Each point on a circle is colored either black or white. Prove that there exist three equally spaced points of the same color.
} }
\solution{This problem is exactly the same as linethreecolor} \solution{This problem is exactly the same as Pidgeonhole 7}
} }
\problemdef{Pidgeonhole}{10}{ \problemdef{Pidgeonhole}{10}{
\difficulty{4}
\statement{ \statement{
Let n be an integer not divisible by $2$ and $5$. Show that n has a multiple consisting entirely of ones. Let n be an integer not divisible by $2$ and $5$. Show that n has a multiple consisting entirely of ones.
@ -201,6 +209,8 @@
\problemdef{Pidgeonhole}{11}{ \problemdef{Pidgeonhole}{11}{
\difficulty{5}
\statement{ \statement{
Prove that for any $n > 1$, there exists an integer made of only sevens and zeros that is divisible by $n$. Prove that for any $n > 1$, there exists an integer made of only sevens and zeros that is divisible by $n$.
} }
@ -211,6 +221,8 @@
\problemdef{Pidgeonhole}{12}{ \problemdef{Pidgeonhole}{12}{
\difficulty{4}
\statement{ \statement{
Choose $n + 1$ integers between $1$ and $2n$. Show that at least two of these are co-prime. Choose $n + 1$ integers between $1$ and $2n$. Show that at least two of these are co-prime.
} }
@ -221,6 +233,7 @@
\problemdef{Pidgeonhole}{13}{ \problemdef{Pidgeonhole}{13}{
\difficulty{3}
\statement{ \statement{
Choose $n + 1$ integers between $1$ and $2n$. Show that you must select two numbers $a$ and $b$ such that $a$ divides $b$. Choose $n + 1$ integers between $1$ and $2n$. Show that you must select two numbers $a$ and $b$ such that $a$ divides $b$.
@ -242,6 +255,7 @@
\problemdef{Pidgeonhole}{14}{ \problemdef{Pidgeonhole}{14}{
\difficulty{4}
\statement{ \statement{
Show that it is always possible to choose a subset of the set of integers $a_1, a_2, ... , a_n$ so that the sum of the numbers in the subset is divisible by $n$. Show that it is always possible to choose a subset of the set of integers $a_1, a_2, ... , a_n$ so that the sum of the numbers in the subset is divisible by $n$.
@ -254,6 +268,8 @@
\problemdef{Pidgeonhole}{15}{ \problemdef{Pidgeonhole}{15}{
\difficulty{4}
\statement{ \statement{
Show that there exists a positive integer divisible by $2013$ that has $2014$ as its last four digits. Show that there exists a positive integer divisible by $2013$ that has $2014$ as its last four digits.
} }
@ -263,6 +279,7 @@
\problemdef{Pidgeonhole}{16}{ \problemdef{Pidgeonhole}{16}{
\difficulty{3}
\statement{ \statement{
Let $n$ be an odd number. Let $a_1, a_2, ... , a_n$ be a permutation of the numbers $1, 2, ... , n$. \par Let $n$ be an odd number. Let $a_1, a_2, ... , a_n$ be a permutation of the numbers $1, 2, ... , n$. \par
@ -280,6 +297,7 @@
\problemdef{Pidgeonhole}{17}{ \problemdef{Pidgeonhole}{17}{
\difficulty{4}
\statement{ \statement{
A stressed-out student consumes at least one espresso every day of a particular year, drinking $500$ overall. Show the student drinks exactly $100$ espressos on some consecutive sequence of days. A stressed-out student consumes at least one espresso every day of a particular year, drinking $500$ overall. Show the student drinks exactly $100$ espressos on some consecutive sequence of days.
@ -347,6 +365,8 @@
\problemdef{Pidgeonhole}{18}{ \problemdef{Pidgeonhole}{18}{
\difficulty{1}
\statement{ \statement{
Show that there are either three mutual acquaintances or four mutual strangers at a party with ten or more people. Show that there are either three mutual acquaintances or four mutual strangers at a party with ten or more people.
} }
@ -357,6 +377,8 @@
\problemdef{Pidgeonhole}{19}{ \problemdef{Pidgeonhole}{19}{
\difficulty{5}
\statement{ \statement{
Given a table with a marked point, $O$, and with $2013$ properly working watches put down on the table, prove that there exists a moment in time when the sum of the distances from $O$ to the watches' centers is less than the sum of the distances from $O$ to the tips of the watches' minute hands. Given a table with a marked point, $O$, and with $2013$ properly working watches put down on the table, prove that there exists a moment in time when the sum of the distances from $O$ to the watches' centers is less than the sum of the distances from $O$ to the tips of the watches' minute hands.
} }