عدد كاپريكار

(تم التحويل من Kaprekar number)

In mathematics, a natural number in a given number base is a p-Kaprekar number if the representation of its square in that base can be split into two parts, where the second part has p digits, that add up to the original number. الأعداد مسماة على اسم د. ر. كاپريكار.

التعريف والخصائص

Let n be a natural number. We define the Kaprekar function for base b>1 and power p>0 Fp,b: to be the following:

Fp,b(n)=α+β,

where β=n2modbp and

α=n2βbp

A natural number n is a p-Kaprekar number if it is a fixed point for Fp,b, which occurs if Fp,b(n)=n. 0 and 1 are trivial Kaprekar numbers for all b and p, all other Kaprekar numbers are nontrivial Kaprekar numbers.

For example, in base 10, 45 is a 2-Kaprekar number, because

β=n2modbp=452mod102=25
α=n2βbp=45225102=20
F2,10(45)=α+β=20+25=45

A natural number n is a sociable Kaprekar number if it is a periodic point for Fp,b, where Fp,bk(n)=n for a positive integer k (where Fp,bk is the kth iterate of Fp,b), and forms a cycle of period k. A Kaprekar number is a sociable Kaprekar number with k=1, and a amicable Kaprekar number is a sociable Kaprekar number with k=2.

The number of iterations i needed for Fp,bi(n) to reach a fixed point is the Kaprekar function's persistence of n, and undefined if it never reaches a fixed point.

There are only a finite number of p-Kaprekar numbers and cycles for a given base b, because if n=bp+m, where m>0 then

n2=(bp+m)2=b2p+2mbp+m2=(bp+2m)bp+m2

and β=m2, α=bp+2m, and Fp,b(n)=bp+2m+m2=n+(m2+m)>n. Only when nbp do Kaprekar numbers and cycles exist.

If d is any divisor of p, then n is also a p-Kaprekar number for base bp.

In base b=2, all even perfect numbers are Kaprekar numbers. More generally, any numbers of the form 2n(2n+11) or 2n(2n+1+1) for natural number n are Kaprekar numbers in base 2.

التعريف حسب نظرية الفئات وقواسم الوحدة

We can define the set K(N) for a given integer N as the set of integers X for which there exist natural numbers A and B satisfying the Diophantine equation[1]

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

An n-Kaprekar number for base b is then one which lies in the set K(bn).

It was shown in 2000[1] that there is a bijection between the unitary divisors of N1 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=1modc, and for each unitary divisor d of N1 let e=N1d and ζ(d)=dInv(d,e). Then the function ζ is a bijection from the set of unitary divisors of N1 onto the set K(N). In particular, a number X is in the set K(N) if and only if X=dInv(d,e) for some unitary divisor d of N1.

The numbers in K(N) occur in complementary pairs, X and NX. If d is a unitary divisor of N1 then so is e=N1d, and if X=dInv(d,e) then NX=eInv(e,d).

Kaprekar numbers for Fp,b

b = 4k + 3 and p = 2n + 1

Let k and n be natural numbers, the number base b=4k+3=2(2k+1)+1, and p=2n+1. Then:

  • X1=bp12=(2k+1)i=0p1bi is a Kaprekar number.
Proof

Let

X1=bp12=b12i=0p1bi=4k+312i=02n+11bi=(2k+1)i=02nbi

Then,

X12=(bp12)2=b2p2bp+14=bp(bp2)+14=(4k+3)2n+1(bp2)+14=(4k+3)2n(bp2)(4k+4)(4k+3)2n(bp2)+14=(4k+3)2n(bp2)+14+(k+1)(4k+3)2n(bp2)=(4k+3)2n1(bp2)(4k+4)+(4k+3)2n1(bp2)+14+(k+1)b2n(b2n+12)=(4k+3)2n1(bp2)+14+(k+1)b2n(bp2)(k+1)b2n1(b2n+12)=(4k+3)p2(bp2)+14+i=p2p1(1)i(k+1)bi(bp2)=(4k+3)p2(bp2)+14+(bp2)(k+1)i=p2p1(1)ibi=(4k+3)1(bp2)+14+(bp2)(k+1)i=1p1(1)ibi=(bp2)+14+(bp2)(k+1)i=0p1(1)ibi=(bp2)(k+1)(i=02n(1)ibi)+b2n+1+34=(bp2)(k+1)(i=02n(1)ibi)+4b2n+1+3b2n+1+34=(bp2)(k+1)(i=02n(1)ibi)bp+3b2n+1+34=(bp2)(k+1)(i=02n(1)ibi)bp+3(4k+3)p2+34+3(k+1)i=p2p1(1)ibi=(bp2)(k+1)(i=02n(1)ibi)bp+3(4k+3)1+34+3(k+1)i=1p1(1)ibi=(bp2)(k+1)(i=02n(1)ibi)bp+3+34+3(k+1)i=0p1(1)ibi=(bp2)(k+1)(i=02n(1)ibi)+3(k+1)(i=02n(1)ibi)bp=(bp2+3)(k+1)(i=02n(1)ibi)bp=(bp+1)(k+1)(i=02n(1)ibi)bp=(bp+1)(1+(k+1)i=02n(1)ibi)+1=(bp+1)(k+(k+1)i=12n(1)ibi)+1=(bp+1)(k+(k+1)i=1nb2ib2i1)+1=(bp+1)(k+(k+1)i=1n(b1)b2i1)+1=(bp+1)(k+i=1n((k+1)bk1)b2i1)+1=(bp+1)(k+i=1n(kb+(4k+3)k1)b2i1)+1=(bp+1)(k+i=1n(kb+(3k+2))b2i1)+1=bp(k+i=1n(kb+(3k+2))b2i1)+(k+1+i=1n(kb+(3k+2))b2i1)


The two numbers α and β are

β=X12modbp=k+1+i=1n(kb+(3k+2))b2i1
α=X12βbp=k+i=1n(kb+(3k+2))b2i1

and their sum is

α+β=(k+i=1n(kb+(3k+2))b2i1)+(k+1+i=1n(kb+(3k+2))b2i1)=2k+1+i=1n((2k)b+2(3k+2))b2i1=2k+1+i=1n((2k)b+(6k+4))b2i1=2k+1+i=1n((2k)b+(4k+3))b2i1+(2k+1)b2i1=2k+1+i=1n((2k+1)b)b2i1+(2k+1)b2i1=2k+1+i=1n(2k+1)b2i+(2k+1)b2i1=2k+1+i=12n(2k+1)bi=i=02n(2k+1)bi=(2k+1)i=02nbi=X1

Thus, X1 is a Kaprekar number.

  • X2=bp+12=X1+1 is a Kaprekar number for all natural numbers n.
Proof

Let

X2=b2n+1+12=b2n+112+1=X1+1

Then,

X22=(X1+1)2=X12+2X1+1=X12+2X1+1=bp(k+i=1n(kb+(3k+2))b2i1)+(k+1+i=1n(kb+(3k+2))b2i1)+bp1+1=bp(k+1+i=1n(kb+(3k+2))b2i1)+(k+1+i=1n(kb+(3k+2))b2i1)

The two numbers α and β are

β=X22modbp=k+1+i=1n(kb+(3k+2))b2i1
α=X22βbp=k+1+i=1n(kb+(3k+2))b2i1

and their sum is

α+β=(k+1+i=1n(kb+(3k+2))b2i1)+(k+1+i=1n(kb+(3k+2))b2i1)=2k+2+i=1n((2k)b+2(3k+2))b2i1=2k+2+i=1n((2k)b+(6k+4))b2i1=2k+2+i=1n((2k)b+(4k+3))b2i1+(2k+1)b2i1=2k+2+i=1n((2k+1)b)b2i1+(2k+1)b2i1=2k+2+i=1n(2k+1)b2i+(2k+1)b2i1=2k+2+i=12n(2k+1)bi=1+i=02n(2k+1)bi=1+(2k+1)i=02nbi=1+X1=X2

Thus, X2 is a Kaprekar number.

b = m2k + m + 1 and p = mn + 1

Let m, k, and n be natural numbers, the number base b=m2k+m+1, and the power p=mn+1. Then:

  • X1=bp1m=(mk+1)i=0p1bi is a Kaprekar number.
  • X2=bp+m1m=X1+1 is a Kaprekar number.

b = m2k + m + 1 and p = mn + m − 1

Let m, k, and n be natural numbers, the number base b=m2k+m+1, and the power p=mn+m1. Then:

  • X1=m(bp1)4=(m1)(mk+1)i=0p1bi is a Kaprekar number.
  • X2=mbp+14=X3+1 is a Kaprekar number.

b = m2k + m2m + 1 and p = mn + 1

Let m, k, and n be natural numbers, the number base b=m2k+m2m+1, and the power p=mn+m1. Then:

  • X1=(m1)(bp1)m=(m1)(mk+1)i=0p1bi is a Kaprekar number.
  • X2=(m1)bp+1m=X1+1 is a Kaprekar number.

b = m2k + m2m + 1 and p = mn + m − 1

Let m, k, and n be natural numbers, the number base b=m2k+m2m+1, and the power p=mn+m1. Then:

  • X1=bp1m=(mk+1)i=0p1bi is a Kaprekar number.
  • X2=bp+m1m=X3+1 is a Kaprekar number.
Kaprekar numbers and cycles of Fp,b for specific p, b

All numbers are in base b.

Base b Power p Nontrivial Kaprekar numbers n0, n1 Cycles
2 1 10
3 1 2, 10
4 1 3, 10
5 1 4, 5, 10
6 1 5, 6, 10
7 1 3, 4, 6, 10
8 1 7, 10 2 → 4 → 2
9 1 8, 10
10 1 9, 10
11 1 5, 6, A, 10
12 1 B, 10
13 1 4, 9, C, 10
14 1 D, 10
15 1 7, 8, E, 10

2 → 4 → 2

9 → B → 9

16 1 6, A, F, 10
2 2 11
3 2 22, 100
4 2 12, 22, 33, 100
5 2 14, 31, 44, 100
6 2 23, 33, 55, 100

15 → 24 → 15

41 → 50 → 41

7 2 22, 45, 66, 100
8 2 34, 44, 77, 100

4 → 20 → 4

11 → 22 → 11

45 → 56 → 45

2 3 111, 1000 10 → 100 → 10
3 3 111, 112, 222, 1000 10 → 100 → 10
2 4 110, 1010, 1111, 10000
3 4 121, 2102, 2222, 10000
2 5 11111, 100000

10 → 100 → 10000 → 1000 → 10

111 → 10010 → 1110 → 1010 → 111

3 5 11111, 22222, 100000 10 → 100 → 10000 → 1000 → 10
2 6 11100, 100100, 111111, 1000000

100 → 10000 → 100

1001 → 10010 → 1001

100101 → 101110 → 100101

3 6 10220, 20021, 101010, 121220, 202202, 212010, 222222, 1000000

100 → 10000 → 100

122012 → 201212 → 122012

2 7 1111111, 10000000

10 → 100 → 10000 → 10

1000 → 1000000 → 100000 → 1000

100110 → 101111 → 110010 → 1010111 → 1001100 → 111101 → 100110

3 7 1111111, 1111112, 2222222, 10000000

10 → 100 → 10000 → 10

1000 → 1000000 → 100000 → 1000

1111121 → 1111211 → 1121111 → 1111121

2 8 1010101, 1111000, 10001000, 10101011, 11001101, 11111111, 100000000
3 8 2012021, 10121020, 12101210, 21121001, 20210202, 22222222, 100000000
2 9 10010011, 101101101, 111111111, 1000000000

10 → 100 → 10000 → 100000000 → 10000000 → 100000 → 10

1000 → 1000000 → 1000

10011010 → 11010010 → 10011010

امتداد للأعداد الصحيحة السالبة

Kaprekar numbers can be extended to the negative integers by use of a signed-digit representation to represent each integer.

تمرين في البرمجة

The example below implements the Kaprekar function described in the definition above to search for Kaprekar numbers and cycles in Python.

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[int]:
    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

انظر أيضاً

الهامش

  1. ^ أ ب Iannucci (2000)

المراجع

  • D. R. Kaprekar (1980–1981). "On Kaprekar numbers". Journal of Recreational Mathematics. 13: 81–82.
  • M. Charosh (1981–1982). "Some Applications of Casting Out 999...'s". Journal of Recreational Mathematics. 14: 111–118.
  • Iannucci, Douglas E. (2000). "The Kaprekar Numbers". Journal of Integer Sequences. 3: 00.1.2.