In
mathematics
Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, a
natural number
In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country").
Numbers used for counting are called ''Cardinal n ...
in a given
number base
In a positional numeral system, the radix or base is the number of unique digits, including the digit zero, used to represent numbers. For example, for the decimal/denary system (the most common system in use today) the radix (base number) is t ...
is a
-Kaprekar number if the representation of its square in that base can be split into two parts, where the second part has
digits, that add up to the original number. The numbers are named after
D. R. Kaprekar.
Definition and properties
Let
be a natural number. We define the Kaprekar function for base
and power
to be the following:
:
,
where
and
:
A natural number
is a
-Kaprekar number if it is a
fixed point for
, which occurs if
.
and
are trivial Kaprekar numbers for all
and
, all other Kaprekar numbers are nontrivial Kaprekar numbers.
For example, in
base 10
The decimal numeral system (also called the base-ten positional numeral system and denary or decanary) is the standard system for denoting integer and non-integer numbers. It is the extension to non-integer numbers of the Hindu–Arabic numer ...
, 45 is a 2-Kaprekar number, because
:
:
:
A natural number
is a sociable Kaprekar number if it is a
periodic point In mathematics, in the study of iterated functions and dynamical systems, a periodic point of a function is a point which the system returns to after a certain number of function iterations or a certain amount of time.
Iterated functions
Given a ...
for
, where
for a positive
integer
An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign (−1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the language ...
(where
is the
th
iterate
Iteration is the repetition of a process in order to generate a (possibly unbounded) sequence of outcomes. Each repetition of the process is a single iteration, and the outcome of each iteration is then the starting point of the next iteration. ...
of
), and forms a
cycle of period
. A Kaprekar number is a sociable Kaprekar number with
, and a amicable Kaprekar number is a sociable Kaprekar number with
.
The number of iterations
needed for
to reach a fixed point is the Kaprekar function's
persistence of
, and undefined if it never reaches a fixed point.
There are only a finite number of
-Kaprekar numbers and cycles for a given base
, because if
, where
then
:
and
,
, and
. Only when
do Kaprekar numbers and cycles exist.
If
is any divisor of
, then
is also a
-Kaprekar number for base
.
In base
, all even
perfect number
In number theory, a perfect number is a positive integer that is equal to the sum of its positive divisors, excluding the number itself. For instance, 6 has divisors 1, 2 and 3 (excluding itself), and 1 + 2 + 3 = 6, so 6 is a perfect number.
T ...
s are Kaprekar numbers. More generally, any numbers of the form
or
for natural number
are Kaprekar numbers in
base 2.
Set-theoric definition and unitary divisors
We can define the set
for a given integer
as the set of integers
for which there exist natural numbers
and
satisfying the
Diophantine equation[Iannucci (]2000
File:2000 Events Collage.png, From left, clockwise: Protests against Bush v. Gore after the 2000 United States presidential election; Heads of state meet for the Millennium Summit; The International Space Station in its infant form as seen from ...
)
:
, where
:
An
-Kaprekar number for base
is then one which lies in the set
.
It was shown in 2000
[ that there is a bijection between the ]unitary divisor In mathematics, a natural number ''a'' is a unitary divisor (or Hall divisor) of a number ''b'' if ''a'' is a divisor of ''b'' and if ''a'' and \frac are coprime, having no common factor other than 1. Thus, 5 is a unitary divisor of 60, because 5 an ...
s of and the set defined above. Let denote the multiplicative inverse
In mathematics, a multiplicative inverse or reciprocal for a number ''x'', denoted by 1/''x'' or ''x''−1, is a number which when Multiplication, multiplied by ''x'' yields the multiplicative identity, 1. The multiplicative inverse of a rat ...
of modulo , namely the least positive integer such that , and for each unitary divisor of let and . Then the function is a bijection from the set of unitary divisors of onto the set . In particular, a number is in the set if and only if for some unitary divisor of .
The numbers in occur in complementary pairs, and . If is a unitary divisor of then so is , and if then .
Kaprekar numbers for
''b'' = 4''k'' + 3 and ''p'' = 2''n'' + 1
Let and be natural numbers, the number base , and . Then:
* is a Kaprekar number.
* is a Kaprekar number for all natural numbers .
''b'' = ''m''2''k'' + ''m'' + 1 and ''p'' = ''mn'' + 1
Let , , and be natural numbers, the number base , and the power . Then:
* is a Kaprekar number.
* is a Kaprekar number.
''b'' = ''m''2''k'' + ''m'' + 1 and ''p'' = ''mn'' + ''m'' − 1
Let , , and be natural numbers, the number base , and the power . Then:
* is a Kaprekar number.
* is a Kaprekar number.
''b'' = ''m''2''k'' + ''m''2 − ''m'' + 1 and ''p'' = ''mn'' + 1
Let , , and be natural numbers, the number base , and the power . Then:
* is a Kaprekar number.
* is a Kaprekar number.
''b'' = ''m''2''k'' + ''m''2 − ''m'' + 1 and ''p'' = ''mn'' + ''m'' − 1
Let , , and be natural numbers, the number base , and the power . Then:
* is a Kaprekar number.
* is a Kaprekar number.
Kaprekar numbers and cycles of for specific ,
All numbers are in base .
Extension to negative integers
Kaprekar numbers can be extended to the negative integers by use of a signed-digit representation
In mathematical notation for numbers, a signed-digit representation is a positional numeral system with a set of signed digits used to encode the integers.
Signed-digit representation can be used to accomplish fast addition of integers because ...
to represent each integer.
Programming exercise
The example below implements the Kaprekar function described in the definition above to search for Kaprekar numbers and cycles in Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
.
def kaprekarf(x: int, p: int, b: int) -> int:
beta = pow(x, 2) % pow(b, p)
alpha = (pow(x, 2) - beta) // pow(b, p)
y = alpha + beta
return y
def kaprekarf_cycle(x: int, p: int, b: int) -> List nt
seen = []
while x < pow(b, p) and x not in seen:
seen.append(x)
x = kaprekarf(x, p, b)
if x > pow(b, p):
return []
cycle = []
while x not in cycle:
cycle.append(x)
x = kaprekarf(x, p, b)
return cycle
See also
* Arithmetic dynamics Arithmetic dynamics is a field that amalgamates two areas of mathematics, dynamical systems and number theory. Classically, discrete dynamics refers to the study of the iteration of self-maps of the complex plane or real line. Arithmetic dynamics is ...
* Automorphic number
In mathematics, an automorphic number (sometimes referred to as a circular number) is a natural number in a given number base b whose square "ends" in the same digits as the number itself.
Definition and properties
Given a number base b, a natura ...
* Dudeney number
* Factorion
* Happy number
In number theory, a happy number is a number which eventually reaches 1 when replaced by the sum of the square of each digit. For instance, 13 is a happy number because 1^2+3^2=10, and 1^2+0^2=1. On the other hand, 4 is not a happy number because ...
* Kaprekar's constant
In number theory, Kaprekar's routine is an iterative algorithm that, with each iteration, takes a natural number in a given number base, creates two new numbers by sorting the digits of its number by descending and ascending order, and subtracts th ...
* Meertens number
* Narcissistic number
In number theory, a narcissistic number 1 F_ : \mathbb \rightarrow \mathbb to be the following:
: F_(n) = \sum_^ d_i^k.
where k = \lfloor \log_ \rfloor + 1 is the number of digits in the number in base b, and
: d_i = \frac
is the value of each d ...
* Perfect digit-to-digit invariant
* Perfect digital invariant
* Sum-product number
Notes
References
*
*
*
{{Classes of natural numbers
Arithmetic dynamics
Base-dependent integer sequences
Diophantine equations
Number theory