Convert "Partition Products" to typst

This commit is contained in:
Mark 2025-01-22 21:18:59 -08:00
parent a6460cf075
commit 38bf88d5ea
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
2 changed files with 47 additions and 57 deletions

View File

@ -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}

View File

@ -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.
])