On Some Formulas for Kaprekar Constants

Let b ≥ 2 and n ≥ 2 be integers. For a b-adic n-digit integer x, let A (resp. B) be the b-adic n-digit integer obtained by rearranging the numbers of all digits of x in descending (resp. ascending) order. Then, we define the Kaprekar transformation T ( b , n ) ( x ) : = A - B . If T ( b , n ) ( x ) = x , then x is called a b-adicn-digit Kaprekar constant. Moreover, we say that a b-adic n-digit Kaprekar constant x is regular when the numbers of all digits of x are distinct. In this article, we obtain some formulas for regular and non-regular Kaprekar constants, respectively. As an application of these formulas, we then see that for any integer b ≥ 2 , the number of b-adic odd-digit regular Kaprekar constants is greater than or equal to the number of all non-trivial divisors of b. Kaprekar constants have the symmetric property that they are fixed points for recursive number theoretical functions T ( b , n ) .


Introduction
Let Z be the set of all rational integers. In this article, the symbol [α] with any rational number α stands for the greatest integer that is less than or equal to α.

Definition 2.
(1) For any x ∈ Z(b, n), we say that x is a b-adic n-digit Kaprekar constant if T (b,n) (x) = x.
(2) We see immediately that zero is a b-adic n-digit Kaprekar constant for any b ≥ 2 and n ≥ 2, which we call the trivial Kaprekar constant. Then, we denote by ν(b, n) the number of all b-adic n-digit non-trivial Kaprekar constants. By Ref. [1] (Proposition 1.3), we see that: where we put: for any integers r > s > 0.
Known results: There are some known results that answer some parts of the questions above as follows: (1) In the case where n = 2, by the results on the two-digit Kaprekar transformation given by Young [4] (cf. [1], Theorem 3.1), we see that for any integer b ≥ 2, there exists a b-adic two-digit non-trivial Kaprekar constant if and only if b + 1 is divisible by three.
In this article, we shall prove in Theorem 3(1) and Corollary 3(3) that any five-digit regular Kaprekar constant is given by the above formula obtained by Prichett with m ≥ 1 and that for any integer b ≥ 2, (5) In the case where b = 2, the first author [1] showed that for any n ≥ 2, all two-adic n-digit non-trivial Kaprekar constants are of the form: In particular, we see immediately that: and: (6) In the case where b = 3, the authors [8] showed that for any n ≥ 2, all three-adic n-digit non-trivial Kaprekar constants are of the form: with all pairs (k, ) of integers satisfying 0 < k < and n = 3 − k, and: In particular, we see immediately that: We have the impression that the behavior of the values of ν(b, n), ν reg (b, n) and ν non-reg (b, n) in the list in Example 2 is not only complicated, but also suggestive of some general rules. It seems that it is very hard to obtain general results without observing any case-by-case results. The aim of this article is to see formulas for b-adic n-digit regular and non-regular Kaprekar constants and to study the properties of ν reg (b, n) and ν non-reg (b, n) towards answers to the questions above.
(1) We assume that n is even and define the b(m, n)-adic n-digit integer: (a n−1 a n−2 · · · a i · · · a n 2 +1 a n 2 a n 2 −1 · · · a j · · · a 1 a 0 ) b(m,n) if n ≥ 6, where we put: Then, K(m, n) is a non-trivial Kaprekar constant, which is regular if and only if n = 2 or m ≥ 1.
(2) We assume that n is odd and define the b(m, n)-adic n-digit integer: where we put: Then, L(m, n) is a non-trivial Kaprekar constant, which is regular if and only if m ≥ 1.

Remark 1. (1)
We can see that for any integer n ≥ 2, the sequence: consisting of bases defined in Theorem 1 is the arithmetic progression with the common difference: 2 n 2 + 1 if n is even and n ≥ 4, n + 1 2 if n is odd and the first term: 2 + 2 if n is even and n ≥ 4, n + 1 2 if n is odd.
(2) As we have seen in the known results above, the regular Kaprekar constants K(m, 4), L(m, 3), and L(m, 5) have already been obtained by Hasse and Prichett [6], Eldridge and Sagong [5], and Prichett [7], respectively. (2) Let n ≥ 2 be any integer. We call the sequence: By Theorem 1, we see that the formulas for the numbers a n−1 , . . . , a 0 (resp. b n−1 , . . . , b 0 ) of digits of members in K(n) (resp. L(n)) are given by polynomials in m of degree one. This implies that they can be regarded as arithmetic progressions indexed by m = 1, 2, 3, . . ., as well as the arithmetic progression b(n) \ {b(0, n)} of bases.
As a corollary of Theorem 1, we immediately obtain some results on the positivity of the numbers ν reg (b, n) of all b-adic n-digit regular Kaprekar constants as in the following: (1) Let n ≥ 2 and b ≥ 2 be any integers. If n and b satisfy one of the following conditions: (i) n = 2 and b = 3m + 2 with m ≥ 1, (ii) n is even, n ≥ 4 and b = 2 (iii) n is odd and b = n + 1 2 (m + 1) with m ≥ 1, then: (2) If an integer b ≥ 4 is not a prime number, then for any non-trivial divisor d of b, Therefore, the number of all b-adic odd-digit regular Kaprekar constants is greater than or equal to the number of all non-trivial divisors of b.
Secondly, we obtain formulas for non-regular Kaprekar constants by means of double series of regular Kaprekar constants obtained in Theorem 1 in the following: Theorem 2. Let the notation be as in Theorem 1.

Example 4. (1)
Here is an example of the non-regular constant K(m, n, r) obtained in Theorem 2(1) in the case where m = 4, n = 8, and r = 2. (2) Here is an example of the non-regular constant L(1, n, r) obtained in Theorem 2(2) in the case where n = 9 and r = 4.
As a corollary of Theorem 2, we immediately obtain the following result on the positivity of the numbers ν reg (b, n) of all b-adic n-digit non-regular Kaprekar constants: Corollary 2. For any integers m ≥ 1 and n ≥ 4 satisfying: m ≡ 1 (mod 3) and n ≡ 0 (mod 4) or: m = 1, n ≡ 3 (mod 6) and n ≥ 9, and for any integer r ≥ 2, we see that: In Section 1, we shall prove Theorems 1 and 2 and Corollaries 1 and 2. In Section 2.1, we shall obtain some formulas for all n-digit regular Kaprekar constants in Theorem 3 for n = 5, 7, 9, 11 and Theorem 4 for n = 2, 4, 6, 8. Moreover, we shall see some conditional results on formulas for n-digit regular Kaprekar constants in Proposition 1 for n = 13, 15, 17. Then, we shall see in Section 2.2 some observations on the values of ν reg (b, n). We think that this article is fit for the Special Issue "Number Theory and Symmetry," since Kaprekar constants have the symmetric property that they are fixed points for recursive number theoretical functions T (b,n) .

Proofs of Theorems and Corollaries in the Introduction
In this section, we prove Theorem 1 and Corollary 1 on regular Kaprekar constants and Theorem 2 and Corollary 2 on non-regular Kaprekar constants, respectively.

A Proof of Theorem 1
(1) Let the notation be as in Part (1) of Theorem 1. Here, we omit proving the Parts (i)-(iii), since they can be checked by direct calculations.
(2) Let the notation be as in Part (2) of Theorem 1. As we have seen in the known results (2) and (4) in the Introduction, the cases where n = 3 and n = 5 have already been proven by Eldridge and Sagong [5] and Prichett [7], respectively. Therefore, it suffices to prove Part (2) in the case where n ≥ 7.
For any odd integer n ≥ 7, let: be the b(m, n)-adic n-digit integer defined in the assertion of Theorem 1 (2). Let c n−1 ≥ · · · ≥ c 1 ≥ c 0 be the rearrangement of the numbers b 0 , . . . , b n−1 of all digits of L(m, n) in descending order. Then, the relation between b 0 , b 1 , . . . , b n−1 and c 0 , c 1 , . . . , c n−1 is given as in the following: In the situation above, we see that: Proof. By the definition of the numbers of all digits of L(m, n) in Theorem 1 (2), we see immediately that: Therefore, the lemma is proven.
Then, we can prove Part (2) in the case where n ≥ 7 by the same argument as in the proof of Theorem 1(1)(iv). Therefore, we omit the details of the calculations here.

A Proof of Corollary 1
(1) In Cases (i) and (ii), we have the b(m, n)-adic n-digit regular Kaprekar constant K(m, n) by Theorem 1 (1). On the other hand, in Case (iii), we have the b(m, n)-adic n-digit regular Kaprekar constant L(m, n) by Theorem 1 (2). Therefore, we see that for any integers b ≥ 2 and n ≥ 2 satisfying Condition (i), (ii), or (iii), and Part (1) is proven.
(2) For any integer b ≥ 4 that is not a prime number, let d be any non-trivial divisor of b, i.e., d is a divisor of b satisfying 1 < d < b. We put: Since m d ≥ 1 is an integer and n d ≥ 3 is an odd integer satisfying b(m d , n d ) = b, by Theorem 1(2), we have the b-adic n d -digit regular Kaprekar constant L(m d , n d ). Therefore, we see that: Moreover, since n d = n d for any non-trivial divisors d = d of b, we see that L(m d , n d ) = L(m d , n d ). Therefore, the number of all b-adic odd-digit regular Kaprekar constants is greater than or equal to the number of all non-trivial divisors of b, and Part (2) is proven.

Some Formulas for All n-Digit Regular Kaprekar Constants with Specified n
Let K(n) and L(n) be the progressions of n-digit regular Kaprekar constants defined in Definition 3(2) for even and odd positive integers n, respectively. On the other hand, it seems that it is very hard to obtain formulas for all n-digit regular Kaprekar constants. In this subsection, we shall obtain partial results on such formulas by case-by-case arguments.
Firstly, we shall see formulas for all n-digit regular Kaprekar constants in the cases where n = 5, 7, 9, 11 in Theorem 3. Note that, in the case where n = 3, Eldridge and Sagong [5] already proved that a three-digit integer x is a regular Kaprekar constant if and only if x ∈ L(3), i.e., x is of the form: (m(2m + 1)(m + 1)) 2m+2 with m ≥ 1. Although one can obtain a similar result for each odd integer n ≥ 13, the authors would not like to do tedious calculations for solving simultaneous equations obtained by the uniqueness of b-adic expressions of any positive integer for any integer b ≥ 2. ((2m + 2)m(3m + 2)(2m + 1)(m + 1)) 3m+3 with m ≥ 1.
(3) For any integer b ≥ 2, a b-adic nine-digit integer x is a regular Kaprekar constant if and only if x is of the form: where the base b is in the range 5m + 4 < b < 6m + 5 with m ≥ 1.
In particular, when b = 5m + 5, x is a member of L(9). (4) An 11-digit integer x is a regular Kaprekar constant if and only if x ∈ L(11), i.e., x is of the form: with m ≥ 1.
Proof. By Theorem 1, it suffices to show that any regular Kaprekar constant in each case is of the form stated in the assertion. In the following, let b ≥ 2 be any integer.  1 (7)), We see the following magnitude relations among the numbers of all digits of x: Then, we obtain the following: Proof. Since c 4 is the maximum number among all digits of x, This implies that: Since c 1 is the second smallest number among all digits of x, we then see that: This implies that: c 3 − c 1 − 1 = c 0 by the two inequalities above. Moreover, we see that: which implies that: We then see that the following equality holds: This implies that b = 3c 0 + 3 and: Putting m = c 0 ≥ 0, we then see that: x = ((2m + 2)m(3m + 2)(2m + 1)(m + 1)) 3m+3 .
If m = 0, then we see a contradiction that x = (20211) 3 is not regular. Therefore, m ≥ 1, and Part (1) is proven.
(2) For any b-adic seven-digit regular Kaprekar constant x, we denote by (c 6 c 5 c 4 c 3 c 2 c 1 c 0 ) b with: the rearrangement in descending order of the numbers of all digits of x. By the same argument as in the proof of Part (1), we then see that one of the following two equalities holds: The equality (i) implies a contradiction that c 2 = − 1 2 .
The equality (ii) implies that b = 4c 0 + 4 and: Putting m = c 0 ≥ 0, we then see that: If m = 0, then we see a contradiction that x = (3203211) 4 is not regular. Therefore, m ≥ 1, and Part (2) is proven.
the rearrangement in descending order of the numbers of all digits of x. By the same argument as in the proof of Part (1), we then see that one of the following six equalities holds: The equalities (i) and (v) imply a contradiction that c 4 = c 3 . The equalities (iii), (iv), and (vi) imply a contradiction that c 5 = c 4 . The equality (ii) implies that b = c 3 + 3c 0 + 3 and: Putting m = c 0 ≥ 0, we then see that x is equal to: where the base b is in the range 5m + 4 < b < 6m + 5, since: If m = 0, then we see a contradiction that b is in the range 4 < b < 5. Therefore, m ≥ 1, and Part (3) is proven.
(4) For any b-adic 11-digit regular Kaprekar constant x, we denote by (c 10 c 9 c 8 c 7 the rearrangement in descending order of the numbers of all digits of x. By the same argument as in the proof of Part (1), we then see that one of the following twenty equalities holds: The equality (i) implies a contradiction that c 5 ≤ c 4 . The equalities (ii), (x), (xii), and (xiii) imply a contradiction that c 10 = c 9 . The equalities (iii), (iv), (vii), (xi), and (xviii) imply a contradiction that c 7 < c 6 . The equality (v) implies a contradiction that c 6 < c 5 . The equalities (viii) and (xvi) imply a contradiction that c 7 = c 6 .
The equality (xx) implies a contradiction that c 8 < c 7 .
Secondly, we see formulas for all n-digit regular Kaprekar constants in the cases where n = 2, 4, 6, 8 in Theorem 4. Although one can obtain a similar result for each even integer n ≥ 10, the authors would not like to do tedious calculations for solving simultaneous equations obtained by the uniqueness of b-adic expressions of any positive integer for any integer b ≥ 2.
Note that we shall need more calculations of solving simultaneous equations in the proof for even cases in Theorem 4 than odd cases in Theorem 3, because, in the case where n ≥ 2 is even, the Kaprekar transformation T (b,n) may not necessarily give us the maximum number b − 1 among the numbers of all digits. (m(2m + 1)) 3m+2 with m ≥ 0.
(2) A four-digit integer x is a regular Kaprekar constant if and only if x = (3021) 4 or x ∈ K(4), i.e., x is of the form: with m ≥ 1.

Proof.
(1) For any b-adic two-digit regular Kaprekar constant x, we denote by  1 (2)), We then see that one of the following two equalities holds: The equality (i) implies a contradiction that c 0 = −1.
(2) For any b-adic four-digit regular Kaprekar constant x, we denote by (c 3 c 2 c 1 c 0 ) b with b − 1 ≥ c 3 > c 2 > c 1 > c 0 ≥ 0 the rearrangement in descending order of the numbers of all digits of x. By Ref. [1] (Theorem 1.1 (6)), we see that one of the following six equalities holds: The equalities (i), (ii), and (vi) imply a contradiction that c 3 = b.
The equality (v) implies that b = 5c 0 + 5 and: Putting m = c 0 ≥ 0, we then see that: If m = 0, then we see a contradiction that x = (3032) 5 is not regular. Therefore, m ≥ 1, and Part (2) is proven.
(3) For any b-adic six-digit regular Kaprekar constant x, we denote by (c 5 c 4 c 3 c 2 c 1 c 0 ) b with:  1 (6)), Since The equality b − (c 5 − c 0 ) = c 0 implies a contradiction that b = c 5 , and the equality c 4 − c 1 = c 4 implies a contradiction that c 1 = 0 > c 0 . Therefore, we see that one of the following nine equalities holds: The equality (i) implies that x = (530421) 6 . The equality (ii) and (iii) imply a contradiction that c 2 = c 1 .
If m = 0, then we see a contradiction that x = (631764) 10 is not regular. Therefore, m ≥ 1. The equality (viii) implies that b = 7c 0 + 6 and: Putting m = c 0 ≥ 0, we then see that: If m = 0, then we see a contradiction that x = (420432) 6 is not regular. Therefore, m ≥ 1.
If m = 0, then we see a contradiction that x = (640632) 8 is not regular. Therefore, m ≥ 1, and Part (3) is proven.
(4) For any b-adic eight-digit regular Kaprekar constant x, we denote by (c 7 c 6 c 5 c 4 c 3 c 2 c 1 c 0 ) b with: the rearrangement in descending order of the numbers of all digits of x. By Ref.
The equality (vii) implies a contradiction that c 7 < c 6 .
We shall also obtain some conditional results on formulas for n-digit regular Kaprekar constants in the following proposition for which we omit the proof because one can prove them by the same arguments as in the proof of Theorem 3: Proposition 1. Let the notation be as in Theorem 3. For any integer b ≥ 2, we see the following: (1) A b-adic 13-digit integer x = (a 12 · · · a 0 ) b with 0 ≤ a 0 , . . . , a 12 ≤ b − 1 satisfying the condition: is a regular Kaprekar constant if and only if x ∈ L(13) with b ∈ b(13), i.e., x is of the form: with m ≥ 1.
(2) A b-adic 15-digit integer x = (a 14 · · · a 0 ) b with 0 ≤ a 0 , . . . , a 14 ≤ b − 1 satisfying the condition: a 13 > a 5 > a 12 > a 4 > a 11 > a 3 > a 10 > a 2 > a 9 > a 1 is a regular Kaprekar constant if and only if x is of the form: where m 1 ≥ 1, m 2 is in the range: and b is in the range: (3) A b-adic 17-digit integer x = (a 16 · · · a 0 ) b with 0 ≤ a 0 , . . . , a 16 ≤ b − 1 satisfying the condition: a 15 > a 6 > a 14 > a 5 > a 13 > a 4 > a 12 > a 3 > a 11 > a 2 > a 10 > a 1 is a regular Kaprekar constant if and only if x is of the form: where b satisfies the conditions: with m ≥ 1.

Some Observations on ν reg (b, n) with Specified n
As a corollary to Theorems 3 and 4, we can make some observations on the numbers ν reg (b, n) of all b-adic n-digit regular Kaprekar constants for n = 2, 4, 5, 6, 7, 8, 9, 11 as in the following: Corollary 3. Let b ≥ 2 be any integer. Then, we see the following: where the sets A 1 , A 2 , and A 3 are defined as:    (1) The intersections of the sets A 1 , A 2 , and A 3 in Corollary 3 (4) are the following: (2) The intersections of the sets B 1 , B 2 , B 3 , and B 4 in Corollary 3 (6) are the following:

Remark 5.
We can see that Corollary 3(1)-(5) matches the values of ν r in the list in Example 2.
Proof. We see immediately that Parts (1)-(6) and (8) are implied by the respective formulas obtained in Theorem 3(1), (2), (4) and Theorem 4 for the respective digits n, since these formulas give distinct n-digit regular Kaprekar constants for distinct positive integers m, and we see that: as mentioned in Remark 4. Now, we prove Part (7) for the case where n = 9. Since the formula obtained in Theorem 3(3) gives distinct b-adic nine-digit regular Kaprekar constants for distinct pairs (b, m) of suitable integers b and m, we see that: where the symbol stands for the number of all elements in the set.
For any integer b ≥ 0, we then see that: Therefore, Part (7) is proven.
Moreover, as a corollary to Proposition 1, we can obtain lower bounds for ν reg (b, n) with n = 13, 15, 17 as in the following:  (3) Proof. (1) We see immediately that Part (1) is implied by the conditional formula obtained in Proposition 1(1), since the formula gives distinct (7m + 7)-adic 13-digit regular Kaprekar constants for distinct positive integers m.