+0

# Number 7

0
144
4

How many 6-digit numbers have at least one 7 in them, that is, in numbers 100,000 to 999,999?. I thank you for any help.

Apr 12, 2019

#1
+2

$$\text{We're talking a 6 digit number that is made up of the digits 0-6, 8-9}\\ \text{For the first digit we have 8 choices}\\ \text{For the remaining 5 digits we have 9 choices each}\\ 8 \cdot 9^5 = 472392$$

.
Apr 12, 2019
#2
+2

Integers that contain no 7s  =

(8 choices) for 1st digit    [ not 0 or 7 ]

(9 choices) for each of the next 5 digits  [ no 7s ]   = (9)^5

So....

8 * 9^5  =  472392

And we have  999,999 - 100,000 + 1  = 900,000 possible 6 digit integers

So.......the number that contain at least one 7  =

900,000 - 472392  =

427608   Apr 12, 2019
edited by CPhill  Apr 12, 2019
#3
+2

CPhill: You have a reversal typo in your last answer. I wrote a short computer code to count them and it agrees with yours(corrected).

Rom: Yours is to be subtracted from 900,000 to get the right number.

def getCount(x) : count = 0; for i in range(100000, 999999) : count = count + has7(i); return count; print("Total = ", getCount(x)): Total =427,608 numbers that have at least one 7 in them.

Apr 12, 2019
#4
+2   