This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/1008/. Also, please do not modify any references to the original work (if any) contained in this content.
I've seen this problem in 4th grade exersize book: fill the tank with 4 liters of water using 3-liter and 5-liter buckets.
We could employ computer and solve it using brute force approach - by checking all available variants. Here is the calculator.
Search depth limits the outputted solutions to certain number of actions (otherwise you can get many repetitions)