Easier than you think

Logic Level 2

When you list the integers from 1 to 100, how many 7's have you written down?

19 20 21 18

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.

1 solution

{ 7 , 17 , 27 , 37 , 47 , 57 , 67 , 70 , 71 , 72 , 73 , 74 , 75 , 76 , 77 , 78 , 79 , 87 , 97 } \{ 7,17,27,37,47,57,67,70,71,72,73,74,75,76,77,78,79,87,97 \} are the natural numbers less than 100 100 and contain 7 7 as a digit.

NOTE : \text{NOTE : } 77 77 has two sevens.

_____________________________________________________________________________ \text{\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_}

As an answer to Challenge master , I generalized the number of times a particular digit (non-zero)appears before 1 0 n 10^{n}

ξ ( 1 0 n ) = r = 1 n r ( n r ) 9 n r \huge{\xi\left(10^{n}\right) = \displaystyle\sum_{r=1}^n r\dbinom{n}{r}9^{n-r} }

Moderator note:

This is the most simplistic approach.

Bonus question : What would the answer be if I replace the number 100 by 1000? How about 10000 instead? Can you find a pattern?

In response to @Calvin Lin : I have added a general form of the solution , is it correct?

Siddharth Bhatnagar - 6 years ago

Log in to reply

That's a really complicated number to evaluate.

The question can be answered in 5 seconds, with the correct interpretation.

Calvin Lin Staff - 6 years ago

Log in to reply

I was just very keen to bring the general form through combinatorics, and I agree the answer can be found in less than 5 seconds , as the pattern goes like 1 , 20 , 300 , 4000 , 50000...... 1,20,300,4000,50000......

Siddharth Bhatnagar - 6 years ago

Log in to reply

@Siddharth Bhatnagar Right. What is the simple one-line reasoning for that?

Hint: Rule of sum/product

Calvin Lin Staff - 6 years ago

Log in to reply

@Calvin Lin reasoning : \color{#D61F06}{\text{reasoning :}} Say, if we require the number of occurences of a digit y y before 1 0 n 10^{n} , then its clear

we have n n places to fill, with atleast one occurence of y y anywhere out of the n n places and the rest n 1 n-1 places are to be filled with any of [ 0 , 9 ] [0,9] ( ten choices \text{ten choices} )

Thus by rule of products, we have n × 1 0 n 1 \boxed{n\times10^{n-1}} as the total number of occurences .


Siddharth Bhatnagar - 6 years ago

Log in to reply

@Siddharth Bhatnagar Different idea for same formula:

a n = 10 a n 1 + 1 0 n 1 a_n=10·a_{n-1}+10^{n-1} because in the last n 1 n-1 digits, it appears a n 1 a_{n-1} times for each of the first digit, which is 10 a n 1 10·a_{n-1} , and then you add the first 7 for all 1 0 n 1 10^{n-1} numbers between 700...0 and 799...9.

It's then easy to show that a n = n 1 0 n 1 a_n=n·10^{n-1} .

Laurent Shorts - 5 years, 2 months ago

Log in to reply

@Laurent Shorts Indeed.

If we wanted to count the number of times that the digit (say) 7 appears in the kth position, we can set the remaining n 1 n-1 digits to be anything from 0 to 9, giving us 1 0 n 1 10 ^ {n-1} possibilities. Multiplying by the number of positions, the answer is n × 1 0 n 1 n \times 10^{n-1} .

Calvin Lin Staff - 5 years, 2 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...