07. Functions and recursion
7.01. Write a function which takes three numbers and returns
if the smallest one of them is prime.
7.02. Write a function which takes a character and returns if
the character is either digit or letter.
7.03. Write a function which takes four numbers – coordinates
of two points – , and returns the distance
between and .
7.04. Write a function which takes six numbers – coordinates
of three points in , and returns if they lie on a straight
7.05. Write a function which takes three numbers –
coordinates of a vector, and returns the length of the
7.06. Write a function which by a given real number x and a
non-negative integer n returns x raised to the n-th power.
Use Karatsuba multiplication method (recursion).
7.07. Write a program which asks the user for a non-negative
integer and gives the number of Fibonacci.
7.08. Write a program which asks the user for a number and
prints the first numbers of Tribonacci.
7.09. Write a program which asks the user for a non-negative
integer and gives the n-th number of the sequence
, with .
7.10. Write a function which takes one integer and returns
7.11. Write a program which asks the user for the numbers
and prints the number of combinations . Hints:
, also and .
2D A(x1, y1) B(x2, y2)
n n − th
an+2 = 5an+1 − 6an + 6n a0 = 0 a1 = 1
0 ≤ k ≤ n (
k) = n!
k!(n − k)! = Ck
n = Cn
n = 1 Ck
n = Ck
n−1 + Ck−1 n−1
7.12. Write a function which by given n, finds the number of
solutions of the system in natural numbers :
7.13. Write a function which takes two integers, which are
not all zero, and returns the largest positive integer that
divides each of the integers (greatest common divisor). For
example, the GCD of 8 and 12 is 4. Use [Euclid’s algorithm]
7.14. Write a function which calculates the value of a given
polynomial using [Horner’s method](https://en.wikipedia.org/
wiki/Horner%27s_method “Markdown Tutorial”).
ℕ ∪ 0
x1 + x2 + x3 + X4 + x5 = n
x1 < 10
1 − ≤ x2 < 30
x5 < 30
Example input Expected output