The Jug Filling Problem on the TI-84 CE

The Jug filling Problem is a very interesting problem which can quickly take you into some fairly deep territory in the overlap between Maths and Computer Science. It is closely related to the Euclidean Algorithm, which is a method for finding the greatest common divisor of two numbers. (In the UK you might be more familiar with the term “highest common factor”). The ancient Greeks were doing some amazing stuff with algorithms in their time, and I sometimes wonder what they would have made of some of the modern innovations we take for granted. For example, what if a TI-84 graphing calculator made it’s way back through time into Euclid’s hands – he would probably think Athena of Apollo had bestowed a magical gift upon him.

Using the TI-84, we can explore the Jug Filling Problem with the help of a little TI-Basic programming.

You can download the 8XP (TI-Basic) file for this program here.

The goal is to use the options to end up with a value of 1 in one of the jugs. There are multiple solutions.

Once you’ve mastered the idea, you could try modifying the code to have different sizes of jug. If you like coding in TI-Basic (which can be a little frustrating compared to other languages), you could replace the hard-coded jug sizes with more easily modified constants.

Let me know what you think in the comments. If you want any part of the code explained I will try and help too.


Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join our mailing list

Join our mailing list to receive awesome articles about learning Python and Computer Science in a fun and accessible way, straight to your inbox.

 Take your Python skills to the next level!

with our free email course on object oriented programming with Python