Mathematical Theory, Computing Implementation and Digital Electronics Simulation of Kaprekar's Routine
The purpose of this ‘Innovative Practice’ article is to propose a multidisciplinary project spanning discrete mathematics, computer programming and electronics through the study of Kaprekar's routine. The theoretical component consists of teaching the concepts of arithmetic in different bases and cycle searches in groups of finite cardinality. Students will then realise this algorithm computationally, learning notions of iterative and modular programming. Finally they will implement it with combinatorial and sequential digital electronics with circuit simulation software. Kaprekar's routine is as follows: choose a number, then form the two numbers from the rearrangement of the digits in descending and ascending order and take their difference. Repeat this procedure with the result of the subtraction until you recover a previous number, and hence the process is a repeating cycle, or the result settles on a constant called the Kaprekar constant. The result of the routine depends on both the base and the number of digits. For example, in base ten, an initial choice of any 4 digit number will always result in the constant 6174 whereas a 5 digit number will result in a cycle of 3 or 4 numbers. This simple routine can be studied from multiple approaches, giving rise to a rich multidisciplinary student experience. From the mathematical approach, we can easily find these constants in base 10 on the internet, but less so in base n. We present the demonstration for 3-digit numbers in base 10. Using a computer programming approach, we have developed a Python script to find these constants and cycles in bases 2 to 10. We describe the algorithms of 11 functions contained in this script as a possible teaching template. Taking a digital electronics approach, we developed several circuits and sub-circuits using the open-source software package Logisim. We also present the automated creation of circuits from truth tables using Karnaugh tables. In addition, this project naturally contains measures against student plagiarism. The Kaprekar constants or cycles depend on the bases used, and hence the same project can be assigned to several groups of students who cannot copy from one another. In short, the algorithm for finding Kaprekar's constants and cycles is very simple, yet the mathematical demonstrations, computer programming implementation and digital electronics simulation are far less trivial. But in the end, this project would produce a prototype that even primary school children can use in a little game!
Authors
- A. Lehmann (ORCID: https://orcid.org/0000-0002-5398-8230)
- Schott Pierre (ORCID: https://orcid.org/0000-0002-8456-4430)
Institutions
- Institut Supérieur d'Électronique de Paris (FR)
Publication Details
- Published
- 2024-10-13
- DOI
- https://doi.org/10.1109/fie61694.2024.10893314
- Citations
- 1
- Primary Topic
- Varied Academic Research Topics
- Type
- article
- Field-Weighted Citation Impact
- 0.53