If you hate simple math:
The best chance to replenish a generation of silkmoths is from 5-6 cocoons. That means you leave 5-6 cocoons in every silkmoth cupboard you got, boil the rest for profit and then when the silkmoths emerge, shift them between the cupboards to have as many breeding pairs as possible.
______________________________________________
In short:
percentage of having at least 1 breeding pair from cocoons =
pnumber of all possible male/female combinations =
nn = number_cocoons^2
p = ((n - 2) / n) * 100Purpose = boiling as much cocoons as possible with solid chance of saving enough to replenish the whole generation from remaining cocoons
I might be wrong, it's allways better to do the math for yourself

______________________________________________
Thinking too fast here ^^
Yeah, it's pretty simple. It's the chance to have at least one breeding pair = chance to have 1 female and male.
example:
you got 2 cocoons, each of them can become male and female with 50 % chance, all posibilities:
male x male (eww)
male x female (oh yeah)
female x male (oooh baby)
female x female (in terms of reproduction - eww, otherwise.... ooooooh boy! ^^)
Try that on 3, 4, ... cocoons if you don't see the pattern here.
Number of all options = number_of_cocoons^2
Number of gay options = final static int gay = 2; ^_^ if I recall correctly = 2 options are allways fully gay no matter how many cocoons you use
And finaly the percentage = ((number_of_cocoons^2-2)/number_of_cocoons^2)*100
Follow the standard mathematical order of operations.