#import "@local/handout:0.1.0": *

#show: handout.with(
  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.
])
