Artificial intelligent assistant

Word problem on collecting specified liters with two pails I am thinking through an interesting puzzle. John is near a lake and has two pails, one holding 4 liters, the other holding 7 liters. The pails have no markings. All John knows is if a pail is empty or full and the capacities of the full pails. I am trying to determine all of the (integer) number of liters (between 1-11) that John can exactly obtain in this scenario. For instance, I know he can obtain 3 liters by filling the 7 liters pail full and transferring as much as he can into the 4 liter pail so that the remainder in the 7 liters pail is 3 liters. I am looking for a method to systematically work through determining the possibilities that can be obtained.

2*4 - 7 = 1: Fill (4), pour (4) -> (7), Fill (4), pour (4) into (7) till (7) is full. 1 liter is left in 4.

2*(2*4 - 7) = 2: After doing the above, empty (7), pour the 1 liter left in (4) into (7), then do the same steps as before again. But this time you are left with 2 liters in the (4) when the (7) is filled.

3 liters can be obtained as you've indicated. Higher amounts can be obtained by putting 0, 1, 2, 3 or 4 liters in one of the buckets, then completely filling the other.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy c00aa746be54a0e89f2da60c0eaf7c81