Procédé de Kaprekar - Lycée Emmanuel d'Alzon (Nîmes)

Article
Résumé de la production
We take an integer (with 2 digits for the explanations);
• We put their digits in a descending order: it give us N1 = ba (such as b ≥ a);
• Then we put the same digits in an ascending order: we get N2 =ab (such as a ≤ b);
• After we subtract N1 by N2, it give us the difference D such as D = N1 – N2 = ba – ab.
And we do the algorithm again with the difference D until we find a loop or an end. We can complete the number with 0 at the left in order to always start with an integer with the same number of digits (2 in this example).