Without Repeating Digits

Level pending

Between 20000 and 70000, find the number of even integers in which no digit is repeated , Let x x Be The Solution !

What are the last 3 digits of x x ?


The answer is 392.

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.

2 solutions

Hisham Sacar
Feb 20, 2014

Consider 2 cases:

case 1: When units digit is 2, 4, or 6: n 1=4x8x7x6x3=4032 case 2: When units digit is 0 or 8: n 2=5x8x7x6x2=3360

n=n 1+n 2=7392

so last 3 digit is 392

Ayon Pal
Jan 26, 2014

python

ans = []
def iseven(n):
    if n % 2 == 0:
        return True
    else:
        return False

 def repeatdigitdetected(n):
    a = []
    b = []  
    if type(n) == int:
        n = abs(n)
        for i in str(n):
            i = int(i)
            a.append(i)
        for i in a:
            if i not in b:
                b.append(i)
        if a == b:
            return False
        else:
            return True
for i in range(20000,70001):
        if iseven(i) == True and repeatdigitdetected(i) == False:
               ans.append(i)
 print len(ans) % 1000

that prints the answer 392 \boxed{392} :-)

I had no idea that this was a programming problem. Anyway, here's my solution in Python that took me a couple of minutes to write:

counter = 0

def distinctdigits(n):
    s = str(n)
    if len(set(s)) == len(s):
        return True
    else:
        return False

for x in xrange(20001, 70000):
    if (x % 2 == 0) and (distinctdigits(x) == True):
            counter = counter + 1

print counter % 1000

The programme outputs 392 as the answer.

Mark Mottian - 7 years, 4 months ago

Log in to reply

U r right but my python function were already ready and so i copy and paste them. and so my answer seems big. :v . btw, ur solution is great.

Ayon Pal - 7 years, 4 months ago

Log in to reply

Yeah, my "distinct digits" function was quite lazy ... but it works. :)

Mark Mottian - 7 years, 4 months ago

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...