10 points

What is the largest integer whose digits are all different that is divisible by each of its individual digits?

Advertisements

~ by wcuk on August 20, 2008.

6 Responses to “10 points”

  1. Rather than figuring out the logic behind the answer, I’m brute forcing it with Python as I type this. At this rate, I may have the answer by the time I wake up tomorrow.

  2. The answer to life, the universe, and everything, is 42.

  3. 9867312

  4. Don cheated and stayed up late.

    num = 987654321
    cond = ‘true’
    while cond:
    numArray = []
    modArray = []
    numStr = str(num)
    for x in numStr:
    numArray.append(x)
    if ‘0’ in numArray:
    num -= 1
    elif numArray.count(‘1’) > 1:
    num -= 1
    elif numArray.count(‘2’) > 1:
    num -= 1
    elif numArray.count(‘3’) > 1:
    num -= 1
    elif numArray.count(‘4’) > 1:
    num -= 1
    elif numArray.count(‘5’) > 1:
    num -= 1
    elif numArray.count(‘6’) > 1:
    num -= 1
    elif numArray.count(‘7’) > 1:
    num -= 1
    elif numArray.count(‘8’) > 1:
    num -= 1
    elif numArray.count(‘9’) > 1:
    num -= 1
    else:
    for g in numArray:
    mod = num % int(g)
    modArray.append(mod)
    if max(modArray) == 0:
    print str(num) + ‘ and done’
    cond = ‘false’
    else:
    num -= 1

    Not sure if this will format correctly.

  5. ok here it is. rather than a modified bubble sort (which would have been faster, I just decremented — that’s what she said):

    num = 987654321
    cond = ‘true’
    while cond:
    –numArray = []
    –modArray = []
    –numStr = str(num)
    –for x in numStr:
    —-numArray.append(x)
    –if ‘0’ in numArray:
    —-num -= 1
    –elif numArray.count(“1”) > 1:
    —-num -= 1
    –elif numArray.count(“2”) > 1:
    —-num -= 1
    –elif numArray.count(“3”) > 1:
    —-num -= 1
    –elif numArray.count(“4”) > 1:
    —-num -= 1
    –elif numArray.count(“5”) > 1:
    —-num -= 1
    –elif numArray.count(“6”) > 1:
    —-num -= 1
    –elif numArray.count(“7”) > 1:
    —-num -= 1
    –elif numArray.count(“8”) > 1:
    —-num -= 1
    –elif numArray.count(“9”) > 1:
    —-num -= 1
    –else:
    —-for g in numArray:
    ——mod = num % int(g)
    ——modArray.append(mod)
    —-if max(modArray) == 0:
    ——print str(num) + ‘ and done’
    ——cond = ‘false’
    —-else:
    ——num -= 1

    I think that will work.

  6. Winner winner, chicken dinner. 10 points for Don.

    Also, sorry about the smiley faces. I wish I could turn them off.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: