How many 8s between 1 and 100 ?


This popular meme catches folks out with most popular wrong answers being 11 and 19.








The correct answer is 20 - ten each in units and ten in tens column.  

08,18,28,38....,98 and 

80,81,82,83....,89



88 is counted twice having a 8 in both the units and ten column.



Shifting the range from 1..100 to 00..99 makes this easier to visualise the answer. 



In 00..99 there are 100 two digit numbers each built using two digits 0,1,2,3,4,5,6,7,8,9. Each digit is used evenly including the same number of 1 & 2s etc because that's how counting works. 200 digits divided by 10 choices is 20. There must be 20 each of all the digits. 



This puzzle would be harder asking the 1s that needed to be painted (21 to include 100) or using roman counting.



An alternative voice has the workman painting 1..100 on {each} of the 100 apartments making 20 * 100 = 2000 number 8's. This is a less useful arrangement as the post man will just dump all his mail for the whole building thought the first door he sees.

1 comment:

SMT Solvers, introduction and links (Start here with the readme)

Picat - First steps

 Getting started with a new software system can always be a little daunting. Just a little bit of help to get over the curb can make that jo...