Self numbers and self primes

In 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. A number N is said to be a self number if it cannot be written as m + the sum of digits of m for any m.

To find out if a given number is a self number, the idea is to iterate from 1 to N and for each number check that sum of its value and sum of its digits is equal to N or not. If yes then the number is not a self number. Otherwise, the number is a self number.

Okay, I’ve understood self numbers (1, 3, 5, 7, 9, 20, 31, 42, 53,..) and self primes (3, 5, 7, 31, 53, 97, 211,..) now, and can find them using Python.

But a question still remains; is there a practical usage to them or simply the curiosity itself, which I enjoy 🙂 I resolved to Twitter:

The response I got was the there isn’t any known application for them, a part from the curiosity itself 🙂

Try yourself here: using the Commandline argument to enter a number to test for self number.