Week 5: Thursday ---------------- Q1. (50) A positive integer n is square-free if it is not divisible by any perfect square, except 1. For example, 44 is not square-free as it is divisible by 4 = 2*2; 6 is square-free. The Mobius function M(n) for a positive integer n is defined as follows: M(n) = 0 if n is not square-free M(n) = +1 if n is square-free with even number of prime factors M(n) = -1 if n is square-free with odd number of prime factors For example, M(44) = 0 as it is not square-free; M(6) = +1 as it has 2 prime factors (2 and 3); M(30) = -1 as it has three prime factors (2, 3 and 5). Write a program that inputs a positive integer and outputs its Mobius function. Your program should implement the following two functions (other than the main): 1. int square_free(int n): returns 1 if n is square_free, 0 otherwise 2. int mobius(int n): returns the mobius function of n Q2. (50) Euclid numbers E(n) are positive integers of the form E(n) = P(n) + 1, where P(n) is the primorial of n. Primorial of n is defined as the product of first n prime numbers (prime numbers start from 2). For example, P(0) = 1 (base case); P(1) = 2; P(2) = 6 (2 x 3); P(5) = 2310 (2 x 3 x 5 x 7 x 11). Write a program that prints all the Euclid numbers until the first composite Euclid number is reached. Your program should implement the following two functions (other than the main): 1. int isprime(int n): returns 1 if n is prime, 0 otherwise 2. int primorial(int n): returns the primorial of n