From 151d05ea3a257500c8f3a624e88d3aa41891dd7b Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 22 Jan 2025 21:18:59 -0800 Subject: [PATCH] Convert "Partition Products" to typst --- src/Warm-Ups/Partition Products/main.tex | 57 ------------------------ src/Warm-Ups/Partition Products/main.typ | 47 +++++++++++++++++++ 2 files changed, 47 insertions(+), 57 deletions(-) delete mode 100755 src/Warm-Ups/Partition Products/main.tex create mode 100644 src/Warm-Ups/Partition Products/main.typ diff --git a/src/Warm-Ups/Partition Products/main.tex b/src/Warm-Ups/Partition Products/main.tex deleted file mode 100755 index a440b7e..0000000 --- a/src/Warm-Ups/Partition Products/main.tex +++ /dev/null @@ -1,57 +0,0 @@ -\documentclass[ - solutions, - singlenumbering, - nopagenumber -]{../../../lib/tex/ormc_handout} -\usepackage{../../../lib/tex/macros} - - -\title{Warm-Up: Partition Products} -\uptitler{\smallurl{}} -\subtitle{Prepared by Mark on \today.} - -\begin{document} - - \maketitle - - \problem{} - Take any positive integer $n$. \par - Now, write it as sum of smaller positive integers: $n = a_1 + a_2 + ... + a_k$ \par - Maximize the product $a_1 \times a_2 \times ... \times a_k$ - - - - \begin{solution} - - \textbf{Interesting Solution:} - - Of course, all $a_i$ should be greater than $1$. \par - Also, all $a_i$ should be smaller than four, since $x \leq x(x-2)$ if $x \geq 4$. \par - Thus, we're left with sequences that only contain 2 and 3. \par - \note{Note that two twos are the same as one four, but we exclude fours for simplicity.} - - \vspace{2mm} - - Finally, we see that $3^2 > 2^3$, so any three twos are better repackaged as two threes. \par - The best sequence $a_i$ thus consists of a maximal number of threes followed by 0, 1, or 2 twos. - - \linehack{} - - - - \textbf{Calculus Solution:} - - First, solve this problem for equal, non-integer $a_i$: - - \vspace{2mm} - - We know $n = \prod{a_i}$, thus $\ln(n) = \sum{\ln(a_i)}$. \par - If all $a_i$ are equal, we get $\ln(n) = k \times \ln(n / k)$. \par - Derive wrt $k$ and set to zero to get $\ln(n / k) = 1$ \par - So $k = n / e$ and $n / k = e \approx 2.7$ - - \vspace{2mm} - - If we try to approximate this with integers, we get the same solution as above. - \end{solution} -\end{document} \ No newline at end of file diff --git a/src/Warm-Ups/Partition Products/main.typ b/src/Warm-Ups/Partition Products/main.typ new file mode 100644 index 0000000..103959a --- /dev/null +++ b/src/Warm-Ups/Partition Products/main.typ @@ -0,0 +1,47 @@ +#import "@local/handout:0.1.0": * + +#show: doc => handout( + doc, + quarter: link( + "https://betalupi.com/handouts", + "betalupi.com/handouts", + ), + + title: [Warm-Up: Partition Products], + by: "Mark", +) + +#problem() +Take any positive integer $n$. \ +Now, write it as sum of smaller positive integers: $n = a_1 + a_2 + ... a_k$ \ +Maximize the product $a_1 #sym.times a_2 #sym.times ... #sym.times a_k$ + + +#solution([ + *Interesting Solution:* + + Of course, all $a_i$ should be greater than $1$. \ + Also, all $a_i$ should be smaller than four, since $x <= x(x-2)$ if $x >= 4$. \ + Thus, we're left with sequences that only contain 2 and 3. \ + #note([Note that two twos are the same as one four, but we exclude fours for simplicity.]) + + #v(2mm) + + Finally, we see that $3^2 > 2^3$, so any three twos are better repackaged as two threes. \ + The best sequence $a_i$ thus consists of a maximal number of threes followed by 0, 1, or 2 twos. + + #v(8mm) + + *Calculus Solution:* + + First, solve this problem for equal, real $a_i$: + #v(2mm) + We know $n = product(a_i)$, thus $ln(n) = sum(ln(a_i))$. \ + If all $a_i$ are equal, we get $ln(n) = k #sym.times ln(n / k)$. \ + Derive wrt $k$ and set to zero to get $ln(n / k) = 1$ \ + So $k = n / e$ and $n / k = e #sym.approx 2.7$ + + #v(2mm) + + If we try to approximate this with integers, we get the same solution as above. +])