Let $\operatorname{Part}(n)$ be the set of integer partitions of $n$.

A partition $p \in \operatorname{Part}(n)$ has $k$ summands and $d$ distinct summand $n\_i$, with $d \leq k$ and $d$ frequencies $f\_i$ such that $\sum\_i^d f\_i \cdot n\_i = n$.

Notice that $\sum\_i^d f\_i = k$.

The probability of $n\_i$ within a given partition $p$ is thus $P(n\_i) = f\_i/k$.

This allows to define an entropy function on $\operatorname{Part}(n)$, $H(p) = -\sum\_i^d P(n\_i)\cdot \log(P(n\_i))$.

Note that I etched this definition of $H$ of a partition of $n$ myself so that it may be non-standard.

I am looking for the maximal value of $H$ for a given $n$: $H\_{\max}(n)$.

I have crunched some values for small $n$ by enumerating $k$-compositions of $n$ and computing $H$ on the underlying partition.

The minimum of $H$ is $0$ and occurs notably when $k=1$ or $k=n$. The maximum is more interesting. For $n=12$, it apparently occurs when $k=4$. For $n=16$, when $k=5$. For $n=24$, when $k=6$. For $n=32$, when $k=7$.

I was initially looking for the maximum values for given $k$ and $n$. I am now interested in the maximum for a given $n$, regardless of $k$.

I believe this may have musical applications. My intent is to filter rhythms by the entropies of their underlying partitions using fuzzy logic. Having an easily computable function for the maximum value of $H$ would make it possible to normalize its values for a specific $p$ and filter by percentage for any $n$.

Next thing I'll try is to compute $H\_{\max}(n)$ for small $n$ then fit the curve with some regression model.

**UPDATE:**
Enlightened by *aorq*'s comment on how to obtain the optimal $k$ given $n$, I was able to compute $H\_{max}(n)$ quite rapidly for the specific values I wanted by enumerating the compositions of $k$ to obtain frequencies $f\_i$ that maximize $H$.

Here are the values if you are interested:

$n=12, k=4, H\_{max}=1.3862943611198906$

$n=16, k=5, H\_{max}=1.6094379124341005$

$n=24, k=6, H\_{max}=1.7917594692280547$

$n=32, k=7, H\_{max}=1.945910149055313$

$n=96, k=13, H\_{max}=2.5649493574615376$

$n=192, k=19, H\_{max}=2.9444389791664403$

$n=384, k=27, H\_{max}=3.2958368660043296$

Thanks again sir!!

**OTHER UPDATE:** $H\_{max} = \log(\lfloor (\sqrt{1+8n}-1)/2\rfloor)$ or $\log(k)$.