def is_palindrome(n, base=10):
    """
    Is the given number n a palindrome in the given base?
    """
    if base == 10:
        n_str = str(n)
    elif base == 2:
        n_str = "{0:b}".format(n)
    else:
        raise RuntimeError("Only 2 and 10 bases supported")
    
    for i in range(len(n_str) // 2):
        if n_str[i] != n_str[-1 - i]:
            return False

    return True