MathDB
distance between two 5-digit numbers

Source: Indian Postal Coaching 2007 set 3 p6

May 25, 2020
number theorySum

Problem Statement

De fine the distance between two 55-digit numbers a1a2a3a4a5\overline{a_1a_2a_3a_4a_5} and b1b2b3b4b5\overline{b_1b_2b_3b_4b_5} to be the largest integer jj such that ajbja_j \ne b_j . (Example: the distance between 1652316523 and 1645216452 is 55.) Suppose all 55-digit numbers are written in a line in some order. What is the minimal possible sum of the distances of adjacent numbers in that written order?