Example #1
0
def solve():
    d = 0
    while 1:
        # the number of digits
        d = d + 1
        start = 10 ** (d - 1)
        end = 10 ** d

        for i in range(start, end):
            # if the length not match
            if len(str(6 * i)) > len(str(2 * i)):
                break

            # calculate the digits of 2x, 3x, 4x, 5x, 6x and sort it
            x2 = mathlib.getDigits(i * 2)
            x2.sort()
            x = []
            x = [mathlib.getDigits(i * j) for j in range(3, 7)]
            for lst in x:
                lst.sort()
            isOK = True

            for lst in x:
                if x2 != lst:
                    isOK = False
                    break
                else:
                    pass

            if isOK == True:
                return i

    return -1
Example #2
0
def solve():
    maxsum = 0
    for a in range(1, 100):
        for b in range(1, 100):
            number = a ** b
            maxsum = max(sum(getDigits(number)), maxsum)
    return maxsum
Example #3
0
def squareAdd(num):
    return sum([x*x for x in mathlib.getDigits(num)])
Example #4
0
def solve():
    return sum(mathlib.getDigits(2**1000))