Week 5: Wednesday ----------------- Q1. (50) The mth Bernoulli number B(m) is defined recursively as follows: B(m) = 1 - sum of all (k = 0 to m - 1) of { (m choose k) * B(k) / (m - k + 1) } The base case is B(0) = 1. Write a program to compute the first 10 Bernoulli numbers. Q2. (50) The totient number T(n) of a positive integer n is defined to be the number of positive integers less than or equal to n that are coprime to n (i.e., having no common factor other than 1). For example, T(1) = 1 (special case); T(9) = 6 (as 1, 2, 4, 5, 7 and 8 are coprime with 9). Write a program that takes a positive integer as input and calculates its totient number. Your program should implement the following two functions (other than the main): 1. int coprime(int m, int n): returns 1 if m and n are co-prime, 0 otherwise 2. int totient(int n): returns the totient number of n