A problem by Dharma Teja

Level pending

HOW MANY FIVE DIGIT POSTIVE INTEGERS THAT ARE DIVISIBLE BY THREE CAN BE FORMED USING DIGITS 0,1,2,3,4 AND 5 WITHOUT REPETATION


The answer is 216.

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

Brock Brown
Jan 8, 2015
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
def valid(number):
    s = str(number)
    for digit in '6789':
        if digit in s:
            return False
    for digit in '012345':
        if s.count(digit) > 1:
            return False
    return True
count = 0
for i in xrange(10000,100000):
    if valid(i):
        if i % 3 == 0:
            count += 1
print "Answer:", count

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...