4
$\begingroup$

5-digit numbers are created using the digits 1, 2, 3, 4, and 5. Any two numbers can have at most one corresponding digit equal to each other.

How many different 5-digit numbers can you get in total that satisfy the above condition?

if this question was asked for 3-digit with 3 different numbers, the answer will be 9.

  • 111
  • 212
  • 223
  • 122
  • 231
  • 313
  • 133
  • 321
  • 332
$\endgroup$
2
  • $\begingroup$ Your example list chosen from three different numbers appears to be incorrect as, for example, it includes '111' (with three digits 'equal to each other') and does not include '331' (which has 'one digit equal to each other') - if I understand your requirements correctly. $\endgroup$
    – Penguino
    Commented Dec 17, 2022 at 18:47
  • $\begingroup$ Ah, I understand now. No two three digit numbers have identical digits in two or more locations. $\endgroup$
    – Penguino
    Commented Dec 17, 2022 at 18:53

2 Answers 2

3
$\begingroup$

Note that the answer cannot exceed 25 since the number of distinct combination of two digits is 25 (11, 12, 13, .... 53, 54, 55).

It turns out we can find a solution with exactly 25 numbers.

First 2 digits must be all the 25 two-digit distinct pairs. Then note that for every starting digit, the five digits at any other position must be all distinct values. As you keep adding digits, additional conditions will be imposed. I tried cyclic shifts of 12345 for the 3rd, 4th and 5th positions for every starting digit and ended up with a solution.

11211
12322
13433
14544
15155
21334
22445
23551
24112
25223
31452
32513
33124
34235
35341
41525
42131
43242
44353
45414
51143
52254
53315
54421
55532

$\endgroup$
3
$\begingroup$

There is a simple rule to generate such a set of numbers

As Manish already explained, the first 2 digits must form distinct numbers among the numbers in the set because else you would have 2 digits in common. So the best we can hope is to have one number for every 2 starting digits. There are 25 of them.

A simple rule is to repeat the same difference between digits, mod 5.
If the first 2 digits are A and A+d, you continue A+2d A+3d and A+4d. All of this modulo 5 (kind of, 0 is replaced by 5).

If two digits are in common between 2 numbers, then the 5 digits must be in common.

for example: 25??? will be 25314 (2+3=5, 5+3=8=3, 3+3=6=1, 1+3=4)

The complete set is:
11111 12345 13524 14253 15432
21543 22222 23451 24135 25314
31425 32154 33333 34512 35241
41352 42531 43215 44444 45123
51234 52413 53142 54321 55555

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.