The Good Idea Fairy struck again today. I have been taking about data checking and data safety with my freshmen lastly. One of the things we talk about is parity checking (I blogged about that three years ago at Making Magic With Software) Garth Flint offered the term “Good Idea Fairy” in a comment there. In any case I started to think about other things we do in computing for data integrity. Things like cyclic redundancy check (CRC).
CRC is an important topic and I do talk about it. The math is not something I want to do with my freshmen though. Still I wanted something that would be quick and easy to have them do. That lead me to think about check digits. They are used in all sorts of things and yet some of them are fairly easy to calculate. The check digits used for the machine readable numbers on passports for example.
The formula is simple. The first digit is multiplied by 7, the second digit by 3, and the third digit by 1. Then the cycle repeats so the fourth digit is multiplied by 7 and so on. The results are added together and the result divided by 10 with the integer remainder being the check digit.. Calculating the check digit for a birthday (in the format yymmdd) is pretty trivial but gives students an idea of what is involved.
So I did that with student in class. Step two of the Good Idea Fairy is now I have more ideas for programming projects.
The easy version is to calculate a check digit from a set of numbers entered. That’s ok. And maybe fun for a bit. But I was thinking – suppose I created a data set of numbers with check digits and had students write code to scan the file for invalid data. Or just build a new data set with the check digit added. Now those would be more interesting. That may happen soon.
What is the latest project or teaching idea the Good Idea Fairy has hit you with?