# Kaprekar number

Not to be confused with Kaprekar's constant.

In mathematics, a Kaprekar number for a given base is a non-negative integer, the representation of whose square in that base can be split into two parts that add up to the original number again. For instance, 45 is a Kaprekar number, because 452 = 2025 and 20+25 = 45. The Kaprekar numbers are named after D. R. Kaprekar.

## Definition

Let X be a non-negative integer. X is a Kaprekar number for base b if there exist non-negative integers n, A, and positive number B satisfying:

X2 = Abn + B, where 0 < B < bn
X = A + B

Note that X is also a Kaprekar number for base bn, for this specific choice of n. More narrowly, we can define the set K(N) for a given integer N as the set of integers X for which[1]

X2 = AN + B, where 0 < B < N
X = A + B

Each Kaprekar number X for base b is then counted in one of the sets K(b), K(b2), K(b3),….

## 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.

The first few Kaprekar numbers in base 10 are:

1, 9, 45, 55, 99, 297, 703, 999, 2223, 2728, 4879, 4950, 5050, 5292, 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 base 12, the 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, 99999, EEEEE, 12E649, 16EX51, 1X1X1X, 222222, 22X54X, 26X952, 35186E, 39X39X, 404040, 4197X2, 450770, 5801E8, 5EE600, ...

## Properties

• It was shown in 2000[1] that the Kaprekar numbers for base b are in bijection with the unitary divisors of bn − 1, in the following sense. Let Inv(a,b) denote the multiplicative inverse of a modulo b, namely the least positive integer m such that am ≡ 1 (mod b). Then, a number X is in the set K(N) (defined above) if and only if X = d Inv(d, (N−1)/d) for some unitary divisor d of N−1. In particular,