String Of Digits

Let S = s 1 , s 2 , s 3 , S = \langle s_1, s_2, s_3, \dots \rangle be a string of N N digits (0 through 9) with the following property:

For any three distinct digits a , b , c a, b, c , there is an index 1 n N 2 1 \leq n \leq N-2 such that { s n , s n + 1 , s n + 2 } = { a , b , c } \{s_n, s_{n+1}, s_{n+2}\} = \{a, b, c\} . In other words, every set of three distinct digits occurs as a substring in S S but not necessarily in that order.

What is the length N N of the shortest string S S with this property?

Note : It is not difficult to estimate a lower bound for N N ; but there is no guarantee that a string of that length actually exists...

Examples and Assumptions

A set of three digits may occur as a substring of S S more than once.

In the string abceabdeacdebcd each subset of the three letters { a e } \{a\dots e\} occurs at least once. The subset { b , c , e } \{b, c, e\} occurs twice, once as bce near the beginning and once as ebc near the end.


The answer is 122.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

The number of unordered subsets of three digits is ( 10 3 ) = 120. \left(\begin{array}{c} 10 \\ 3 \end{array}\right) = 120. In order for there to be 120 distinct substrings of length 3 in S S , it should contain at least 122 characters. Thus N 122. N \geq 122.

This is the easy part. Much harder is to prove that a string of length 122 with these properties actually exists. Logically the most convincing proof is to give a concrete example. I found

1
2
0124691258937891368925604568035692371235702369048902479036715
6791467034823468134701590135801478267802578145934579245812601

Every set of three digits occurs exactly once as a subset of this string. (I verified using an Excel spreadsheet.) Thus N = 122 N = \boxed{122} is the solution.

Bonus : How did I find this string? It consists of 10 groups of 12 digits, each based on the string 012469125893 Add 7 (mod 10) to each digit in this group to find the next 12 digits; then add 4 (mod 10); and so on. Let's call this "translation". Finally, attach the first two digits to the end to complete the cycle.

Finding this generating string was an interesting puzzle; I found a guiding algorithm to construe it, which I will not explain here.

Graph theory : The question whether the lower bound estimate N = ( 10 3 ) + 2 N = \left(\begin{array}{c} 10 \\ 3\end{array}\right)+2 can actually be obtained is equivalent to finding a Hamilton path in the graph consisting of all sets of three digits, in which two sets are connected by an edge iff they have two digits in common. This graph consists of 120 vertices and 1260 edges; each vertex has order 21. My solution proves that a Hamilton cycle exists in this particular graph.

Challenge : What is the solution if the digit 0 is no longer allowed? The theoretical minimum is N 84 + 2 N \geq 84+2 , but a cyclic solution as the one given here has N = 90 + 2 N = 90+2 digits; it is redundant, containing each of the sets { 1 , 4 , 7 } , { 2 , 5 , 8 } , { 3 , 6 , 9 } \{1, 4, 7\}, \{2, 5, 8\}, \{3, 6, 9\} three times. (It is easy to see why!) My conjecture is that a solution with N = 84 + 2 N = 84+2 does not exist, but I would love to proven wrong; or right!

How each vertex has order 18 ???

Kushal Bose - 4 years, 9 months ago

You are right, it is not 18 but 21.

Every vertex { a , b , c } \{a, b, c\} is connected to all vertices of the form { x , b , c } \{x, b, c\} , { a , x , c } \{a, x, c\} , and { a , b , x } \{a, b, x\} , with x a , b , c x \not= a, b, c . Since there are seven possible values for x x and three possible positions, each vertex has order 7 × 3 = 21 7\times 3 = 21 .

Arjen Vreugdenhil - 4 years, 9 months ago

Log in to reply

Yes now its clear

Kushal Bose - 4 years, 9 months ago

Sir can you please suggest me some resources for studying combinatorics from basics?

Thanks.

Harsh Shrivastava - 4 years, 9 months ago

Log in to reply

I don't have a specific title for you. I grew up with Dutch textbooks, and don't suppose that you will be able to read that language...

Arjen Vreugdenhil - 4 years, 9 months ago
Alapan Chaudhuri
May 30, 2018

Form subset of unordered digits and find a suitable lower bound.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...