text_plain_output_1.png
def max_digit(n, d, r):
    max_number = -1
    n = abs(n)
    while n > 0:
        digit = n % 10
        if digit % d == r:
            if digit > max_number:
                max_number = digit
        n //= 10
    return max_number
def main():
    n = int(input())
    d = int(input())
    r = int(input())
main()

def binom(n, k):
    res = 1
    if n < 0 or k < 0:
        return 0
    else:
        for i in range(1, n + 1):
            res *= i
        for m in range(1, k + 1):
            res /= m
        for n in range(1, n - k + 1):
            res /= n
        return int(res)
def binomf(n, k):
    res = 1
    if n < 0 or k < 0:
        return 0
    else:
        for i in range(1, n + 1):
            res *= i
        for m in range(1, k + 1):
            res = float(res / m)
        for n in range(1, n - k + 1):
            res = float(res / n)
        return res
def main():
    n = int(input())
    k = int(input())
main()

def prime(n):
    for i in range(2, n):
        if n % i == 0:
            return False
        else:
            return True
def main():
    continue_or_not = True
    while continue_or_not:
        n = int(input())
        if n <= 0:
            continue_or_not = False
main()

def rich(n):
    total_divisors = 0
    for i in range(1, n):
        if n % i == 0:
            total_divisors += i
    if total_divisors > n:
        return True
    else:
        return False
def main():
    k = abs(int(input('Enter a integer: ')))
main()

def f(x):
    if x < 2:
        return f(17 - abs(x))
    if x > 1:
        divisor = 0
        for i in range(2, x):
            if x % i == 0:
                divisor = i
        if divisor != 0:
            d = divisor
            return f(d)
        else:
            return x
def main():
    continue_or_not = True
    while continue_or_not:
        x = int(input('Enter a integer: '))
        if x == 0:
            continue_or_not = False
main()

def g(x):
    return int(x / 2) + 1
def h(x):
    return int(x / 2 + 1)
def f(x):
    if x < 9:
        return x * x
    if x >= 9:
        if x % 2 == 0:
            return f(g(x))
        else:
            return f(h(x + 1))
'\nThe above code can also write as below: (another way)\ndef g(x):\n    return f(int(x/2)+1)\ndef h(x):\n    return f(int(x/2+1))\ndef f(x):\n    if x<9:\n       return x*x\n    if x>=9:\n       if (x%2==0):\n           return g(x)\n       else:\n           return h(x+1)\n'
def main():
    continue_or_not = True
    while continue_or_not:
        x = int(input('Enter a integer: '))
        if x != 0:
            print(f(x))
        if x == 0:
            continue_or_not = False
main()