# Is there are exactly one partition, given length of partition and maximum number?

## Python 2, 38 bytes

lambda n,k,m:m>n-k<2or-1<k*m-n<2+2/m*k


Try it online!

Characterizes the cases where there's only one legal partition.

Consider the partitions of $$\n\$$ into exactly $$\k\$$ parts each between $$\1\$$ and $$\m\$$ inclusive. There's only two ways to for there to be only one such partition.

• The number $$\n\$$ is close to as small as possible ($$\n=k\$$ or $$\n=k+1)\$$ or as large as possible ($$\n=mk-1\$$ or $$\n=mk)\$$ for such a partitions. This leave only enough "wiggle room" for only one partition in each case:
• $$\n=1+1+\cdots +1+1\$$.
• $$\n=2+1+\cdots+1+1\$$.
• $$\n=m+m+\cdots+m+(m-1)\$$.
• $$\n=m+m+\cdots+m+m\$$.
• We allow only $$\m=2\$$ maximum, forcing a unique partition made of 1's and 2's. Such a partition requires $$\k \leq n \leq 2k\$$.

The challenge lets us assume that $$\n>k\$$, so we can omit the $$\n=k\$$ case and $$\k \leq n\$$ check, and, as feersum observed, can let us check $$\n=k+1\$$ as $$\n. The $$\m=1\$$ case makes it impossible to make a partition with $$\n>k\$$, so we make sure it's always rejected. This gives the condition

$$\n \in \{ k+1, mk-1, mk\}\$$and $$\ m>1\$$, or $$\n \leq 2k \$$ and $$\m=2\$$

## Wolfram Language (Mathematica), 39 38 bytes

-1: first argument > other arguments (no length-1 partitions)

1==Tr[1^IntegerPartitions[#,{#2},#3]]&


Try it online!

## Jelly, (10?) 11 bytes

Œṗṁ«⁵ɗƑƇL⁼1


A full program which accepts N numberOfParts maximalSizeOfAnyPart as arguments and prints 1 if exactly one solution exists and 0 otherwise.

Try it online!

### How?

Œṗṁ«⁵ɗƑƇL⁼1 - Main Link: N, numberOfParts
Œṗ          - integer partitions (of N)
Ƈ    - keep those (P) for which:
Ƒ     -   is invariant under:
ɗ      -     last three links as a dyad - i.e. f(P, numberOfParts):
ṁ         -       mould (P) like (numberOfParts)
⁵       -       3rd argument (maximalSizeOfAnyPart)
«        -       minimum (vectorises)
L   - length
1 - literal one
⁼  - equal?
- implicit print


If we may print 1 if exactly one solution exists and 0 OR nothing otherwise then Œṗṁ«⁵ɗƑƇMỊ is a 10 byte full program.