### Kaprekar Number

As stated in Wikipedia, "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."

\(55\) is a Kaprekar number because if we do \(55^2 = 3025\) and split \(3025\) into \(30, 25\) and sum the two parts it turns out to be \(55\) itself. Similarly, \(4879\) is also a kaprekar number. \(4879^2 = 23804641\) and parts \((238, 04641)\) sum up to \(4879\).

Code:

Related posts:

- Split an Integer
- Count the number of digits in an integer
- Compute the power of a number in O(log n) time

If you've found any errors or want to give a feedback then comment below.

References: https://en.wikipedia.org/wiki/Kaprekar_number

## Comments

## Post a Comment