# What is the minimum number of digits required to make the numbers 1-20?

What is the minimum number of digits required to make the numbers $1-20$?

Any $n$ consecutive numbers can be counted as a $n$-digit consecutive number. So, $$12\\34$$ has the numbers $$1, 2, 3, 4, 12, 13, 21, 24, 31, 34, 42, 43$$ but not the numbers $$123, 14$$ because the digits $1, 2, 3$ are not in a straight line, and $1, 4$ are not consecutive. They have to be touching vertically or horizontally.

Note: your answer should be in a grid form, like above, but the answer doesn't have to be in a complete rectangle, so like $$\space\space23\\45\space\space\\678$$ would still be a valid (although incorrect) answer.

## EDIT:

Changed the question from $1-100$ to $1-20$ because it's going to take forever to find the $1-100$ question :)

It looks to me as if this is one optimal solution:

 0 2 9 3 1 1 5 7 1 8 4 6

Why I think it's an optimal solution:

First of all, it's easy to check that it's a solution. Now, since one 1 is next to at most 4 other digits we need to have at least three of them. And we need one of every other digit; so at least 3+9=12 digits. Above, we have exactly 12 digits.

• Never fast enough :( – Quintec Feb 10 '18 at 22:00
• Mmmm yes :) I just realized how easy 1-20 was after I tried to actually solve it myslef, but I realized it was too late to change it...just too fast @GarethMcCaughan – NL628 Feb 11 '18 at 1:10
• I like the logic behind your answer. simple, yet eloquent – Jason V Feb 13 '18 at 13:48
• @NL628 is this the correct answer or not? – Albino Feb 13 '18 at 22:10