def get_ans(): i = 0 while True: i += 1 digit = get_digit(i) val = i is_find = True for j in xrange(2, 7): val += i if get_digit(val)!=digit or not is_perm(i, val): is_find = False break if is_find: return i
def get_ans(): ans = 0 for i in xrange(1, 100): for j in xrange(1, 100): if get_digit(i ** j) == j: ans +=1 return ans