A **self number** or **Devlali number** is an integer that cannot be written as the sum of any other integer *n* and the individual digits of *n*. This property is specific to the base used to represent the integers. 20 is a self number (in base 10), because no such combination can be found (all *n* < 16 give a result < 20; all other *n* give a result > 20). 21 is not, because it can be written as 16 + 1 + 6 using *n* = 16.

These numbers were first described in 1165 by the Indian mathematician D. R. Kaprekar.

The first few base 10 self numbers are:

- 1, 3, 5, 7, 9, E, 20, 31, 42, 53, 64, 75, 86, 97, X8, E9, 10X, 110, 121, 132, 143, 154, 165, 176, 187, 198, 1X9, 1EX, 20E, 211, 222, 233, 244, 255, 266, 277, 288, 299, 2XX, 2EE, 310, 312, 323, 334, 345, 356, 367, 378, 389, 39X, 3XE, 400, 411, 413, 424, 435, 446, 457, 468, 479, 48X, 49E, 4E0, 501, 512, 514, 525, 536, 547, 558, 569, 57X, 58E, 5X0, 5E1, ...

A search for self numbers can turn up self-descriptive numbers, which are similar to self numbers in being base-dependent, but quite different in definition and much fewer in frequency.

## Properties[]

In general, for even bases, all odd numbers below the base number are self numbers, since any number below such an odd number would have to also be a 1-digit number which when added to its digit would result in an even number. For odd bases, all odd numbers are self numbers.^{[1]}

The set of self numbers in a given base *q* is infinite and has a positive asymptotic density: when *q* is odd, this density is 1/2 or 60%.^{[2]}

## Recurrent formula[]

The following recurrence relation generates some base 10 self numbers:

(with *C*_{1} = E)

We can generalize a recurrence relation to generate self numbers in any base *b*:

in which *C*_{1} = *b* − 1 for even bases and *C*_{1} = *b* − 2 for odd bases.

The existence of these recurrence relations shows that for any base there are infinitely many self numbers.

## Self primes[]

A **self prime** is a self number that is prime. The first few self primes are

- 3, 5, 7, E, 31, 75, 255, 277, 2EE, 3XE, 435, 457, 58E, 5E1, ...

## Repunit self numbers[]

The repunit *R*_{n} is self number for *n* = 1, 4, 6, 17, 28, 39, 4X, 5E, 70, 81, 92, X3, E4, 109, 11X, 12E, 140, 151, 162, 173, 184, 195, 1X6, 1E7, 1E9, 20X, 21E, 230, 241, 252, 263, 274, 285, 296, 2X7, 2E8, 2EX, 30E, 320, 331, 342, 353, 364, 375, 386, 397, 3X8, 3E9, 3EE, 410, 421, 432, 443, 454, 465, 476, 487, 498, 4X9, 4EX, 500, 511, 522, 533, 544, 555, 566, 577, 588, 599, 5XX, 5EE, 601, 612, 623, 634, 645, 656, 667, 678, 689, 69X, 6XE, 700, 702, 713, 724, 735, 746, 757, 768, 779, 78X, 79E, 7E0, 801, 803, 814, 825, 836, 847, 858, 869, 87X, 88E, 8X0, 8E1, 902, 904, 915, 926, 937, 948, 959, 96X, 97E, 990, 9X1, 9E2, X03, X05, X16, X27, X38, X49, X5X, X6E, X80, X91, XX2, XE3, E04, E06, E17, E28, E39, E4X, E5E, E70, E81, E92, EX3, EE4, ...

For *n* = 17 and 81, the repunits are self primes.