Are you smarter than me? 48

Find the number of 4-digit numbers (in base 10) having non-zero digits and which are divisible by 4 but not by 8.


The answer is 729.

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.

8 solutions

Tom Van Lier
Apr 14, 2015

There are 9.9.9.4 = 2916 even numbers with 4 non-zero digits in base 10.

Half of them are divisible by 4 = 1458

Half of them last are divisible by 8 = 729, so 729 is also the amount that is divisible by 4 and not by 8.

Its not true that numbers ending in 12,28,36,44,52.,......etc are not divisible by 8..... eg. 1112,1128,1136,....etc. You should have told that number of 4 digit numbers divisible by 4 and having non-zero digits are 9x9x18 by your method and half of them are not divisible by 8

Vighnesh Raut - 6 years, 4 months ago
Mehul Chaturvedi
Dec 28, 2014

We divide the even 4-digit numbers having non-zero digits into 4 classes: those ending in 2,4,6,8.

(A) Suppose a 4-digit number ends in 2. Then the second right digit must be odd in order to be divisible by 4. Thus the last 2 digits must be of the form 12, 32,52,72 or 92. If a number ends in 12, 52 or 92, then the previous digit must be even in order not to be divisible by 8 and we have 4 admissible even digits. Now the left most digit of such a 4-digit number can be any non-zero digit and there are 9 such ways, and we get 9 × 4 × 3 = 108 such numbers. If a number ends in 32 or 72, then the previous digit must be odd in order not to be divisible by 8 and we have 5 admissible odd digits. Here again the left most digit of such a 4-digit number can be any non-zero digit and there are 9 such ways, and we get 9 × 5 × 2 = 90 such numbers. Thus the number of 4-digit numbers having non-zero digits, ending in 2, divisible by 4 but not by 8 is 108 + 90 = 198.

(B) If the number ends in 4, then the previous digit must be even for divisibility by 4. Thus the last two digits must be of the form 24, 44, 54, 84. If we take numbers ending with 24 and 64, then the previous digit must be odd for non-divisibility by 8 and the left most digit can be any non-zero digit. Here we get 9× 5× 2 = 90 such numbers. If the last two digits are of the form 44 and 84, then previous digit must be even for non-divisibility by 8. And the left most digit can take 9 possible values. We thus get 9 × 4 × 2 = 72 numbers. Thus the admissible numbers ending in 4 is 90 + 72 = 162.

(C) If a number ends with 6, then the last two digits must be of the form 16,36,56,76,96. For numbers ending with 16, 56,76, the previous digit must be odd. For numbers ending with 36, 76, the previous digit must be even. Thus we get here (9 × 5 × 3) + (9 × 4 × 2) = 135 + 72 = 207 numbers.

(D) If a number ends with 8, then the last two digits must be of the form 28,48,68,88. For numbers ending with 28, 68, the previous digit must be even. For numbers ending with 48, 88, the previous digit must be odd. Thus we get (9 × 4 × 2) + (9 × 5 × 2) = 72 + 90 = 162 numbers. Thus the number of 4-digit numbers, having non-zero digits, and divisible by 4 but not by 8 is 198 + 162 + 207 + 162 = 729. Alternative Solution:. If we take any four consecutive even numbers and divide them by 8, we get remainders 0,2,4,6 in some order. Thus there is only one number of the form 8k + 4 among them which is divisible by 4 but not by 8. Hence if we take four even consecutive numbers 1000a + 100b + 10c + 2, 1000a + 100b + 10c + 4, 1000a + 100b + 10c + 6, 1000a + 100b + 10c + 8, there is exactly one among these four which is divisible by 4 but not by 8. Now we can divide the set of all 4-digit even numbers with non-zero digits into groups of 4 such 2 consecutive even numbers with a, b, c non zero. And in each group, there is exactly one number which is divisible by 4 but not by 8. The number of such groups is precisely equal to 9 × 9 × 9 = 729

it's just an advice. the more long your explanation is, the less it is read!

jaiveer shekhawat - 6 years, 5 months ago

RMO 2010 right?

Rishik Jain - 5 years, 6 months ago

I did the same. Long but sure solution.

Sarthak Singla - 5 years, 6 months ago
Richard Niescior
Dec 28, 2014

Code Follows Below in Javascript:

var x = 1000,i=0,v=new Array();

for(;x<10000;x++){

    if(x%4 ==0 && x%8!=0 ){

        v[i] = x;
        i++;

    }
}

var t,g,l=new Array(),add,p=0;

for(i=0;i<v.length;i++){

    t=v[i]+"";
    add=0;

        for(g=0;g<t.length;g++){

            if(t[g] == '0')
                {add=1;break;}

        }

    if(add!=1){

        l[p] = v[i];p++;}

}
/*print l.length and you will have your answer*/
Brock Brown
Dec 28, 2014
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
def goal(x):
    if '0' not in str(x):
        if i % 8 != 0:
            return True
    return False
i = 1000
count = 0
while i < 10000:
    if goal(i):
        count += 1
    i += 4 # keep i a multiple of 4
print "Answer", count

sum(1 for i in range(1000, 10000) if not str(i).count('0') and not i%4 and i%8)

Alexey Kononenko - 5 years, 6 months ago

Module Module1

Sub Main()
    Dim counter As Integer = 0
    For n = 1000 To 9999
        Dim the_string As String = n.ToString
        If Not (the_string(0) = "0" Or the_string(1) = "0" Or the_string(2) = "0" Or the_string(3) = "0") Then
            If n Mod 4 = 0 And Not n Mod 8 = 0 Then

                Console.WriteLine(n)
                counter += 1
            End If
        End If

    Next
    Console.WriteLine()
    Console.WriteLine(counter)
    Console.ReadLine()
End Sub

End Module

Akram Mohiddin
Apr 27, 2015

Irisae Jade
Mar 8, 2015

Lets look at a sample set of 1001 thru 1100, every number in here contains a zero and as such is eliminated based on the question. Same applies to 2001 thru 2100, 3001 thru 3100 ...... and finally 9001 thru 9100 Now look at any of the remaining sets of 100 numbers for ex. 1101 thru 1200. We have (100/4) 25 multiples of 4 in here and of those 25, 5 contain zero and of the remaining 18, 9 are divisible by 8 and 4. That leaves us 9 numbers which are divisible only by 4 but not by 8. This trend is similar for any set of 100 numbers. Now we know that we have 9 numbers which do not contain zero and are divisible by 4 but not by 8 in a set of 100 numbers. Alll we have to do now is see how many sets of 100 numbers we have i.e. 1000-1099, 1100-1199................. 9899 thru 9999 or we can simply say (9999-999)/100 = 90. Do not forget to eliminate the sets of 1001 thru 1100, 2001 thru 2100 ....... 9001 thru 9100, altogether 9 sets. That leaves us 90-9 = 81 sets Each of these 81 sets have 9 numbers that are relevant for us, so the answer is 81 * 9 = 729

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...