# The Alchemist's brew

I'm an Alchemist and I want to prepare Universal Panacea. That's a precious thing and I will be able to sell it for good money.

The complete recipe for the Panacea is of course very complex (and secret), but the final step is actually quite simple: I need to boil the component X in a silver cauldron with the right quantity of saltpeter dust and then seal it in vials.

I have a good amount of spare vials. They can contain most of the liquids that exist and have a very precise graduation line to know when they are full. They don't have intermediary lines so you can't directly measure half a vial of liquid.

I have only one silver cauldron. Its shape makes it difficult to judge precisely the amount of liquid it contains but by experience I know eleven vials of liquid can fit inside. There is a tap in the side that make it possible to slowly recover liquid from it but you can't access the bottom half of the cauldron this way (as the tap is in the middle of the side).

Component X is a liquid. I have an opaque barrel of it but as it tends to evaporate I don't know how much there is left. I am quite sure there is enough to fill twice the cauldron though. Component X boils at a temperature around 60°C and I manage to boil it without loosing more that 10% of it with evaporation (sometimes less than 10% evaporates). It also is lighter than water and not miscible with any mundane liquid.

Saltpeter is a powder that reacts with boiling component X to make the Panacea. I need exactly (no more and no less) one pinch and a half of saltpeter per vial of the final product. Yes, I am sure all my pinches will be of the same quantity, I'm an expert alchemist after all. I can't take precise half-pinches: my pinches are regular but their size is not on-demand.

The Panacea is produced by the reaction between saltpeter and boiling component X. Panacea is liquid but it never evaporates, but it can mix with component X, with which it shares all the other physical properties. I need to fill the bigger number possible of vials with it, while being sure there is no remaining saltpeter of component X in the vials.

The only other equipment for chemistry I have is a mundane bathtub. That's where I wash my cauldron and vials so I can be sure there is no unwanted materials in my potions.

How can I manage to get the biggest amount possible of Panacea vials out of my single barrel of component X ?

• My first puzzle on this website. It is not supposed to be very hard, good luck! – Anne Aunyme Jan 26 '18 at 14:21
• hard to read in my opinion. had to read it like 5 times now still couldnt catch where the optimization is... – Oray Jan 26 '18 at 14:27
• @Oray: I try to make it clearer. The optimization is on how to avoid wasting component X (as it evaporates, or as some stay in the bottom of the cauldron). Maybe I should give precise numbers for the volume of the different containers but as that's not needed I prefer not to. (but it that's unreadable without them I will) – Anne Aunyme Jan 26 '18 at 14:44
• @AnneAunyme I think you've given us enough to work with ;) – NexusInk Jan 26 '18 at 17:18

## 3 Answers

Ok third attempt :)

$\bullet$ Fill the cauldron with water to the tap point.
$\bullet$ Tap off what you can until nothing more can be tapped.
$\bullet$ Add 3 vials of Component X to the cauldron.
$\bullet$ Bring to 60°C until it boils.
$\bullet$ Losing at most 10%, you now have at least 2 vials of Component X boiling in the cauldron.
$\bullet$ Since Component X floats on, and does not mix with, water, tapping will get all and only the Component X in the cauldron.
$\bullet$ Tap off all the boiling Component X. This will fill 2 vials completely, plus part of a 3rd.
$\bullet$ Pour exactly 2.0 vials of boiling Component X back into the cauldron.
$\bullet$ Cauldron now has 5.5 vials of water + exactly 2.0 vials of boiling Component X.
$\bullet$ Add exactly 3 pinches of saltpeter.
$\bullet$ You now have exactly 2.0 vials of Panacea in the cauldron!
$\bullet$ Tap those 2.0 vials off.
$\bullet$ You have now tapped off exactly 2.0 vials of Panacea!

Now it's rinse and repeat:
$\bullet$ Fill the 3rd vial completely with more Component X from the barrel.
$\bullet$ Fill two more vials with Component X from the barrel.
$\bullet$ Repeat the process from step 3, until you can no longer tap off two full vials of boiling X.

Since there's no way to measure Component X with greater accuracy than a single vial and no way to measure fractional pinches, and the loss of 10% of Component X in boiling, the smallest batch you can make is 2 boiling vials of Component X + 3 pinches of saltpeter. Once you can no longer make a full batch you are done.

(Note it's possible to double the batch size in the process to speed things up, and then scale back to the single batch when you're low on Component X. I didn't write it up that way because it just adds duplicate steps at the end of the process to handle a final single batch.)

• Where did you get the water? The recipe doesn't ask for water, does it? – NexusInk Jan 26 '18 at 16:47
• @NexusInk From the bathtub. The water doesn't participate in the recipe, as the reagents all float on and do not mix with it; it's just to float the stuff we care about to reach the tap.. – Rubio Jan 26 '18 at 16:48
• @Rubio Yes- I just realized that you used h20 to float your liquid. – NexusInk Jan 26 '18 at 17:04
• @AnneAunyme Ok one more try. This time with no added assumptions, I believe. – Rubio Jan 26 '18 at 17:18
• How many vials of panacea are left after your calculations, @Rubio? – NexusInk Jan 26 '18 at 19:45

This was the intended solution when I wrote the puzzle. It was making a few assumptions that actually make the problem more difficult si it's not the best.

First, notice that water is accessible: you have an operational regular bathtub. fill the bottom half of the cauldron with water and open the tap the remove the excedent water.

Now put all this excedent water in vials. You will have five vials and a bit more of one other full of water and those vials contain exactly what is needed to fill the cauldron up to the tap. Note that you can't use the tap to fill those vials, but you can directly pour the water from the side of the cauldron as you don't need to be precise at all. Moreover if you make a mistake at this point you won't have lost any precious component.

Pour all the content of the barrel in vials. Now you know exactly how much complete vials you have (there may be a few left, put it aside for now)

Pour 11 vials of component X in the cauldron. Add 15 pinches of saltpeter. Boil. Among the 11 vials of component X between 9.9 and 11 vials will remain after boiling.

Put the resulting product on vials. The safest way for this is to use the tap, then add the batch of water which was kept previously and pour what was in the bottom (as water is heavier the panacea will be just at the right level)

If you produced less than 10 vials it means they are saturated in saltpeter, if you produced more it means they don't have enough saltpeter. In any case remove the water from the cauldron back into vials and put the product back in the cauldron. If you had more than 10 vials let the liquid boil at 70°C to let the excess component X evaporate completely: you now have exactly 10 vials of component X. If you had less than 10 vials add one of component X and let it boil. Then you are in the same situation as in the first case.

As long as you have at least 12 spare vials of component X you can repeat those steps, producing each time 10 vials of panacea from 11 or 12 vials of component X.

For the remaining component X put everything in your cauldron and add the maximum number of pinches you can without saturating the panacea (so for N vials of component X you would add floor(N*3/2) pinches. Boil at 70°C to be sure the excess component X evaporated and fill into vials.

You end up in the worst case (depending of your luck with evaporation) with floor(X*5/6) + max(0,(mod(X,12)-2)*9/10) vials and in the bast case with floor(X*10/11) +max(0,mod(X,12)).

Assuming you have enough saltpeter to combine with Component X to make the panacea....

AND assuming that the recipe takes into account that Component X loses some quantity through the actual process...otherwise what kind of alchemical recipe is this?

Huh?

Component X = approx. 22 vials - let's say we have 22.6 vials in the barrel ( 11 vials per cauldron and enough Component X in the barrel to fill the cauldron twice).

Boiling reduces Component X < 10%.

The recipe takes into account that both Component X and the saltpeter are transformed into Panacea, through whatever process. The OP threw in the 10% as smoke....

Mathematical Answer not accounting for evaporation:

22 vials of Panacea cooked in 3 batches

How:

3 pinches for 2 vials [1 & 1/2 pinches per vial]. So for 22 full vials you will need (3 x 11 = 33) 33 pinches of petered salt.

So how do we go about creating batches to cook up our panacea?

We separate

3 batches - 2 batches of 8 vials and 1 batch of 6 vials.

Of course the problem lies in the lack of consistency when adding saltpeter, to find how many pinches in the first 2 batches...

3 pinches per 2 vials = 12 pinches in the first batches of 8 and 9 pinches in the last batch of 6 vials.

Boil each batch and once cooked through, we use the water method as documented by @Rubio to drain the cauldron of the Panacea mixture.

Empty. Rinse (in bathtub). Repeat.

If we consider that we have lost < 10% during the process, then each batch of 8 yields 7.2 vials of Panacea and 6 vial batch yields 5.4 vials of panacea.

[(7.2 {vials} X 2 {batches of 8}) + 5.4 {vials of panacea from 6 vial batch}] = 19.8 vials of Panacea potion.

Were we to cook 2 batches of 11 (which we cannot due to the restrictions of exactly measuring the amount of saltpeter in each batch), we would get:

[(11 {vials} X 2 {batches of 11})- 10%]= [22 {vials} - (22/100 X 10) {loss due to evaporation}] = [22 - 2.2] = 19.8 vials of Panacea Potion. Ching!Ching!

Alternatives to cooking up the potion, eg batches of 4 vials (5 batches with 6 pinches of saltpeter per batch) or 10 vials (2 batches with 15 pinches of saltpeter per batch) will not work as you are left with a lot of unused Component X (2 vials at least), whilst cooking batches of 11 (16.5 pinches required), 9 (13.5 pinches required) or 7 (10.5 pinches required) are not feasible as we cannot accurately measure the saltpeter per vial.

• The recipe uses "one pinch and a half of saltpeter per vial of the final product." That means you have to account for evaporation; the recipe doesn't. – Rubio Jan 27 '18 at 2:15
• I'm not sure. 1 Vial Component X + 1&1/2 pinches of saltpeter boiled = 1 vial of Panacea. After reading your comment I saw why my answer is NOT correct: The recipe does account for evaporation, but I did not - so my final count of vials is not 22 but less ;) – NexusInk Jan 27 '18 at 18:32
• Your error in using 8 vials of Component X and 12 pinches of saltpeter to yield 7.2 vials of Panacea is that the amount of saltpeter needed is 1½ pinches per vial of final product, not per vial of Component X you start with. Your yield will thus have extra saltpeter mixed in, violating the requirement of "being sure there is no remaining saltpeter or component X in the vials". You have to account for the evaporation, and then add saltpeter to the right amount for what you have left. – Rubio Jan 27 '18 at 19:58
• It seems that these alchemists have been exposed much too long to noxious fumes...If what you are saying is correct and it must be as your answer has been accepted, the recipe is still wrong. saltpeter is not used at that stage of creating panacea but much earlier on. Nevertheless, my question, to you, @Rubio, still remains. How many vials of Panacea has the alchemist made? – NexusInk Jan 27 '18 at 20:44
• At least 18. We start with at least 22 vials of Component X. Up to 10% could be lost to evaporation, leaving 19.8, but the minimum batch is 2 vials, so it could be as little as 18 that can actually be made. Since we don't have an upper bound on how much Component X is in the barrel, only a lower bound, we can't know exactly how much gets made; if there's a bit more than 22 vials to start with and/or evaporation takes a bit less than 10%, 20 vials is pretty likely. More than that we can't really say. – Rubio Jan 27 '18 at 21:11