2
$\begingroup$

On applying Kaprekar's routine on all 4 digit numbers and counting how many times any other number is visited, it generates a nice symmetrical grid if plotted on a 100x100 matrix see https://anuraguniyal.github.io/6174/

Visit count of numbers Is there a simple explanation for this pattern?

1 Answers 1

0

If a number has digits $a$, $b$, $c$, and $d$ with $a\geq b\geq c\geq d$ then Kaprekar's routine will give: $$1000a + 100b + 10c + d - 1000d - 100c - 10b - a = 999(a-d) +90(b-c)$$ Notice also that $0 \leq b - c \leq a - d \leq 9$. This means there are only ${11 \choose 2} = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55$ different possible results.

These values $a - d$ and $b - c$ give the coordinates in the grid. The y-coordinate in the grid is given by the lower two digits of the number (or so I gather from the position of the red dot). $a - d$ doesn't affect this much because the coefficient $999$ means this part of the number will only change by $-1$ when $a - d$ increases by $1$. However, $b - c$ has a larger affect because its coefficient is $90$. This means the number changes by $-10$ when $b - c$ increases by 1 (except going from $0$ to $0$ which is the reason for the isolated dot in the upper left as further explained later). This means $b - c$ is the dominating factor in determining the x-coordinate.

The x-coordinate is given by the upper two digits of the number. A change of $1$ in $b - c$ gives a change of only $0$ or $1$ in this coordinate while a change of $1$ in $a - d$ gives a change in the coordinate of $9$ or $10$.

So, the bottom row consists of numbers with $b - c = 0$, the next row up is numbers with $b - c = 1$, and so on. Similarly, the right-most column are numbers with $a - d = 9$, the next column to the left is $a - d = 8$ and so on.

The skewedness of the rows and columns comes from the smaller contributions of $a - d$ to the y-coordinate and $b - c$ to the x-coordinate.

The fact that it is a triangle instead of a full square is due to the $b - c \leq a - d$ constraint.

The point in the upper left "ought" to be in the lower left according to the pattern. This is the point with $a = b = c = d = 0$. But, if $d - a > 0$, then the y-coordinate "underflows" due to the small contribution of $d - a$.

  • 0
    Good explanation. Grid is basically N/100, N%100 does your explanation still applies?2017-02-11
  • 1
    actually same grid because N/100, N%100 is first 2 and last 2 digits :)2017-02-11