Wolfram Library Archive


Courseware Demos MathSource Technical Notes
All Collections Articles Books Conference Proceedings
Title

Sums of Cubes of Digits--Driven to Abstraction
Author

Allan Hayes
Organization: Wolfram Research accredited consultant
Journal / Anthology

Mathematica in Education
Year: 1992
Volume: 1
Issue: 4
Page range: 3-11
Description

One of the fascinating aspects of Mathematica is the way that it encourages exploration in a recognizably mathematical style. The following work was provoked by a simple exercise in some notes on programming in BASIC used at Leicester. Students were asked to write a program for printing out the sums of the cubes of the digits of all integers up to 200. The Mathematica code for the function needed, called g below, is of course very simple: what produced this note was the remark that each sequence p, g[p], g[g[p]],... eventually cycles and that the original program might be modified to print out the periods of these cycles. The solution of this little problem leads naturally to abstract ideas being brought in as efficient tools in a way that I find very satisfying. Besides introducing the ideas of periodicity, a function is looked at as a formula, a graph, a set of ordered pairs and as a look-up table (this is very fast for computation); fixed point methods are used; and inverse functions, closure under a map and partitioning into closed subsets are discussed. The programs make use of pattern matching, the fixed point operator, pure functions and caching. Of course one must generalize to other bases and powers (another kind of abstraction) and this is done in the Appendix.
Subject

*Education