Sequence containing every four-digit combination

Mike314

New member
Joined
Jul 7, 2022
Messages
4
What is the shortest numerical string containing every possible combination of four digits? (0000 - 9999 inclusive)
(To clarify, the string 123456 would contain the combinations 1234, 2345 and 3456.)

In theory, the shortest possible sequence should be 10,003 digits long. But does such a sequence actually exist? Is there a way to prove or disprove it (without writing the whole thing out)?
If it doesn't exist, is there a way to calculate the minimum possible length of our ideal sequence?

Apologies if this is in the wrong forum. Please let me know if I should post elsewhere.
 
What have you tried? Where are you stuck? Have you tried to solve this same problem with 2 digits? Or do you just want the answer?
 
More after the answer. It's academic curiosity, rather than a homework problem.

Context: my flat door has a four-digit code, and I found out recently that there's more than one code that works (and still work if part of a longer string).
Which led me to wondering what the best way to find all possible entry codes was, and that led me here.
 
Sorry, but we do not offers solutions on this forum. Rather we give leading hints. Why not try the problem with 2 digits. It will only take ,maybe ten minutes.
 
There seems to be [imath]10^4[/imath] numbers you have to count. The upper bound would be [imath]4 \times 10^4[/imath] digits then (4 digits for each permutation).
 
Top