# Kaprekar number

In mathematics, a non-negative integer is called a "Kaprekar number" for a given base if the representation of its square in that base can be split into two parts that add up to the original number, with the proviso that the part formed from the low-order digits of the square must be non-zero—although it is allowed to include leading zeroes. For instance, 45 is a Kaprekar number, because 452 = 2025 and 20 + 25 = 45. The number 1 is Kaprekar in every base, because 12 = 01  in any base, and  0 + 1 = 1. The numbers are named after D. R. Kaprekar.

## Definition

Let ${\displaystyle X}$  be a non-negative integer and ${\displaystyle n}$  a positive integer. ${\displaystyle X}$  is an ${\displaystyle n}$ -Kaprekar number for base ${\displaystyle b}$  if there exist non-negative integer ${\displaystyle A}$  and positive integer ${\displaystyle B}$  satisfying the Diophantine equation:

${\displaystyle X^{2}=Ab^{n}+B}$ , where ${\displaystyle 0
${\displaystyle X=A+B}$

If ${\displaystyle d}$  is any divisor of ${\displaystyle n}$ , then ${\displaystyle X}$  is also a ${\displaystyle d}$ -Kaprekar number for base ${\displaystyle b^{n}}$ . A Kaprekar number for base ${\displaystyle b}$  is one which is an ${\displaystyle n}$ -Kaprekar number for that base and some positive integer ${\displaystyle n}$ .

More generally, we can define the set ${\displaystyle K(N)}$  for a given integer ${\displaystyle N}$  as the set of integers ${\displaystyle X}$  for which[1]

${\displaystyle X^{2}=AN+B}$ , where ${\displaystyle 0
${\displaystyle X=A+B}$

An ${\displaystyle N}$ -Kaprekar number for base ${\displaystyle b}$  is then one which lies in the set ${\displaystyle K(b^{n})}$ , and a Kaprekar number for base ${\displaystyle b}$  is one which lies in any one of the sets ${\displaystyle K(b^{i})}$  for any positive integer ${\displaystyle i}$ .

## Examples

297 is a Kaprekar number for base 10, because 2972 = 88209, which can be split into 88 and 209, and 88 + 209 = 297. By convention, the second part may start with the digit 0, but must be nonzero. For example, 999 is a Kaprekar number for base 10, because 9992 = 998001, which can be split into 998 and 001, and 998 + 001 = 999. But 100 is not; although 1002 = 10000 and 100 + 00 = 100, the second part here is zero (i.e. not a positive integer).

The first few Kaprekar numbers in base 10 are:

1, 45, 55, 99, 297, 703, 999, 2223, 2728, 4879, 4950, 5050, 7272, 7777, 9999, 17344, 22222, 38962, 77778, 82656, 95121, 99999, 142857, 148149, 181819, 187110, 208495, 318682, 329967, 351352, 356643, 390313, 461539, 466830, 499500, ... (sequence A006886 in the OEIS)

In particular, 9, 99, 999… are all Kaprekar numbers. More generally, for any base b, there exist infinitely many Kaprekar numbers, including all numbers of the form bn − 1.

## Other bases

In binary, the first 26 Kaprekar numbers are

1, 11, 110, 111, 1010, 1111, 11100, 11111, 100100, 110011, 111111, 1010101, 1011011, 1111000, 1111111, 10001000, 10010011, 10101011, 10111011, 11001101, 11111111, 101010110, 101011111, 101101101, 111110000, 111111111, ...

In ternary, the first 24 Kaprekar numbers are

1, 2, 22, 111, 112, 121, 222, 2102, 2222, 10220, 11111, 11112, 20021, 22222, 101010, 121220, 202202, 212010, 222222, 1101222, 1111111, 1111112, 2012021, 2222222, ...

In base 7, the first 45 Kaprekar numbers are

1, 3, 4, 6, 22, 25, 45, 66, 306, 333, 334, 361, 441, 642, 666, 1452, 2223, 4444, 5215, 6226, 6666, 11112, 15261, 22222, 33333, 33334, 44445, 55555, 66666, 120546, 125665, 136140, 152152, 224500, 303031, 321321, 345346, 363636, 442200, 514515, 530530, 546121, 651406, 652114, 666666, ...

In base 12, the first 41 Kaprekar numbers are

1, E, 56, 66, EE, 444, 778, EEE, 12XX, 1640, 2046, 2929, 3333, 4973, 5E60, 6060, 7249, 8889, 9293, 9E76, X580, X912, EEEE, 22223, 48730, 72392, 99999, EEEEE, 12E649, 16EX51, 1X1X1X, 222222, 22X54X, 26X952, 35186E, 39X39X, 404040, 4197X2, 450770, 5801E8, 5EE600, ...

In base 16, the first 72 Kaprekar numbers are

1, 6, A, F, 33, 55, 5B, 78, 88, AB, CD, FF, 15F, 334, 38E, 492, 4ED, 7E0, 820, B13, B6E, C72, CCC, EA1, FA5, FFF, 191A, 2A2B, 3C3C, 4444, 5556, 6667, 7F80, 8080, 9999, AAAA, BBBC, C3C4, D5D5, E6E6, FFFF, 1745E, 20EC2, 2ACAB, 2D02E, 30684, 3831F, 3E0F8, 42108, 47AE1, 55555, 62FCA, 689A3, 7278C, 76417, 7A427, 7FE00, 80200, 85BD9, 89AE5, 89BE9, 8D874, 9765D, 9D036, AAAAB, AF0B0, B851F, BDEF8, C1F08, C7CE1, CF97C, D5355, ...

## Properties

• It was shown in 2000[1] that there is a bijection between the unitary divisors of  N − 1  and the set  K(N)  (defined above). Let  Inv(a,c)  denote the multiplicative inverse of  a  modulo  c, namely the least positive integer  m  such that  am ≡ 1 (mod c), and for each unitary divisor  d  of  N − 1  let  ζ(d) = d Inv(d, (N − 1)/d). Then the function  ζ  is a bijection from the set of unitary divisors of  N − 1  onto the set  K(N). In particular, a number  X  is in the set  K(N)  if and only if  X = d Inv(d, (N − 1)/d)  for some unitary divisor  d  of  N − 1.
• The numbers in  K(N)  occur in complementary pairs,  X  and  NX. If  d  is a unitary divisor of  N − 1  then so is  e  = (N − 1)/d, and if  d Inv(d, e) = X  then  e Inv(e, d) = NX.
• In binary, all even perfect numbers are Kaprekar numbers. More generally, any numbers of the form  2n−1 (2n − 1)  or  2n−1 (2n + 1), with  n  a positive integer, are binary Kaprekar numbers.
• For any base  b  congruent to 3 mod 4, all numbers of the form  (b2n+1 − 1)/2  and  (b2n+1 + 1)/2, with  n  a positive integer, are Kaprekar numbers for the base  b. Numbers of the first form expressed in base  b  have  2n + 1  digits, all equal to  (b − 1)/2. Those of the second form are just one more than the corresponding one of the first form. In base 11, for instance, 555, 556, 55555, 55556, etc. are Kaprekar numbers, and in base 15, the numbers 777, 778, 77777, 77778 etc. are Kaprekar numbers.
• For any base  b  congruent to 5 mod 16, all numbers of the form  3 (b4n−1 − 1)/4,  (b4n−3 − 1)/4,  (b4n−1 + 3)/4, or  (3 b4n−3 + 1)/4, with  n  a positive integer, are Kaprekar numbers for the base  b. The expansions of the first two of these forms in base  b  comprise strings of  4n − 1  digits all equal to  3 (b − 1)/4 , and  4n − 3  digits all equal to  (b − 1)/4, respectively. Those of the third and fourth forms are just one more than the corresponding ones of the first two forms, respectively. In base 5, for instance, 1, 4, 112, 333, 11111, 33334 etc. are Kaprekar numbers.
• For any base  b  congruent to 13 mod 16, all numbers of the form  3 (b4n−3 − 1)/4,  (b4n−1 − 1)/4,  (b4n−3 + 3)/4, or  (3 b4n−1 + 1)/4, with  n  a positive integer, are Kaprekar numbers for the base  b. The expansions of the first two of these forms in base  b  comprise strings of  4n − 3  digits all equal to  3 (b − 1)/4 , and  4n - 1  digits all equal to  (b − 1)/4, respectively. Those of the third and fourth forms are just one more than the corresponding ones of the first two forms, respectively. In base 13, for instance, 4, 9, 333, 99X, 33334, 99999 etc. are Kaprekar numbers.