Coding to Promote Problem Solving and Logical Reasoning

Ada Lovelace (1815-1852)
Ada Lovelace (1815-1852)

An excellent article, by Scott G. Smith, appeared in the August 2016 edition of MATHEMATICS teacher and published by the National Council of Teachers of Mathematics, got me thinking about how I might use simple coding activities in math classes to promote problem solving and logical reasoning. The author discussed how he used simple coding activities with the TI-84 Graphing Calculator to teach generalization, problem solving and logical reasoning in his algebra 2 classes. Smith provided numerous TI-84 program listings along with explanations.

The purpose of this post is to show how to use an Excel spreadsheet and the TI-BASIC programming language to solve a problem that would be suitable for a high school math class. I chose a spreadsheet solution of the problem because educated adults in a modern economy are expected to have working knowledge of spreadsheets. Then, I chose a TI-84 solution of the problem because programmable calculators are ubiquitous in the modern math classroom.

In a previous post, I discussed algorithms for finding the day-of-week when given a Gregorian or Julian calendar date. If you have not read my post How to Find the Day of the Week for a Given Date, I believe you will find it helpful to read it before continuing because the floor function and mod operator are fully explained. The algorithm for finding the day-of-week given a Gregorian calendar date is given below. This algorithm was also selected for this post because it’s relatively easy to implement in Excel or the TI-BASIC programming language. In my opinion, it’s important that high school students learn the basics of how to use these powerful tools.


The source code of the TI-BASIC program that implements the Gregorian calendar day-of-week algorithm is given below. I indented some lines of code to make the structure of the program easier to understand, but code lines in the TI code editor are left justified. Notice that each line of code starts with character ‘:’ which is automatically inserted by the code editor with each new line of code. After a bit of study, one can easily learn how to translate many algorithms into TI-BASIC code; almost line by line. There are abundant online resources where one can learn how to program in TI-BASIC. In fact, I had to do a bit of research to write this post.


Shown below is the program input and the resulting output after a single run of the TI-BASIC program above. The bold face text is the input the user would enter for the date 12 February 1809. After carefully studying the day-of-week algorithm, the TI-BASIC source code, and a single run of the program, the TI-BASIC code makes perfect sense.


An Excel spreadsheet implementation of the Gregorian day-of-week algorithm is shown below. Note that the text in column B cells of the spreadsheet only serve to clarify what the spreadsheet is about, and to describe what the cells C4 through C13 represent. The spreadsheet formulas (invisible in this view) in cells C7 through C13 generate the numerical and text cell values the user sees. When cells C4, C5 or C6 are changed, cells C7 through C13 are automatically updated.


The reason spreadsheets are so powerful is that cells can contain very complex formulas that determine the numeric or text content of the cell that contains the formula. Shown below are the formulas in cells C7 through C13. I find it fun and interesting to Google a formula that will allow me to easily solve my problem. Notice that the formulas in cells C12 and C13 are broken up into multiple lines, however, formulas in any actual spreadsheet cell are entered as a single continuous string of characters where the first string character is ‘=’.


Some Final Comments, Observations and Suggestions

  • For beginning coders, give students a pseudocode description of an algorithm and then have them implement the algorithm in TI-BASIC or in a spreadsheet. After students learn how to translate statements in an algorithm into computer code, they are ready to start learning how to develop algorithms.
  • Pick problems that relate to their current course work that are relatively easy to solve, but also time consuming and tedious. Students now have a reason to want to learn how to create an algorithm and write code to implement the algorithm.
  • The Common Core Standards for Mathematical Practice do not directly address coding, however, coding activities can certainly help promote the goals of the Common Core Standards.
  • Steve Jobs once said the learning how to program computers is a great way to teach people how to solve problems and reason logically.
  • Coding can become addictive. Years ago, a social studies teacher at my high school reported that parents were complaining that their children were spending too much time outside of class writing Apple Macintosh HyperCard stacks for a social studies class project. The social studies teacher only had to present the project to his class and gave students a short introduction to the coding in the HyperCard language. Students quickly became hooked and simply ran with the project. One class project required over 60 floppy discs to hold the HyperCard stacks!
  • It’s not uncommon to find computer programmers who were music majors in college.
  • Teachers should remind their students that many women have made important contributions to computer science. Ada Lovelace (1815 – 1852), the only legitimate child of the famous poet Lord Byron, was an English mathematician and writer. Around 1843, Ada published an elaborate set of notes that many historians consider to be a description of the first computer program. She also envisioned computers doing much more than just numerical calculations. Rear Admiral Grace Hopper (1906 – 1992), nicknamed “Amazing Grace,” began her career teaching mathematics at Vassar in 1931, and was promoted to associate professor in 1941. In 1934, she earned a Ph. D. in mathematics from Yale. Later she served in the U.S. Navy and other civilian organizations devoted to the development of computer systems and programming languages. Hopper believed computer languages should be similar to the English language rather than the machine language of computers. She made significant contributions to the development of COBOL (COmmon Business-Oriented Language) which is still used in many business applications.

One thought on “Coding to Promote Problem Solving and Logical Reasoning”

Leave a Reply

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