You have to program several functions. Do not use the math module.
Write an integer function @int_root(n)@ that given a natural number returns .
Write a function @int_log(a, b)@ that given natural numbers greater than one and greater than zero returns natural such that .
Write a function @gcd_lcm(a, b)@ that given natural numbers and such that or returns the greatest common divisor and the least common multiple. Your code has to implement the Euclid’s algorithm.
Write a boolean function @is_prime(n)@ that given a natural
number
returns True if and only if
is prime.
In order to play table games at the casino you need some tokens. Red tokens cost euros and yellow tokens cost . Write a function @buy_tokens(n)@ that given a number of euros such that , it returns the equivalence in tokens. When several equivalences are possible the function returns the one minimizing the total number of tokens.
Write a string function @max_overlap(s, t)@ that given two strings and returns the longest string that is a common prefix of and .
The first function counts 15 points. Other ones count 17 point each one.
>>> int_root(19) 4 >>> int_log(3, 20) 2 >>> gcd_lcm(12,18) (6, 36) >>> is_prime(51) False >>> buy_tokens(50) (6, 2) >>> max_overlap('bugs', 'bunny') bu