Project Task #2: Write a MATLAB function to compute "sigma(n)", the sum of the divisors of the integer n.
COMMENT: For any integer n, sigma(n) is defined to be the sum of all the numbers i that are divisors of n, including 1 and n.
For instance, the divisors of 9 are 1, 3 and 9, and so sigma(9) is 13.
Although there are shortcuts to computing sigma(n), a simple procedure to compute sigma(n) is simply to consider each value i between 1 and n, and add it to the total if it is a divisor of n.
INSTRUCTIONS:
Since we want to write a function, the filename must be "sigma.m". Write the appropriate function header. Initialize your total to zero. Loop If I is a divisor of N, add it to the total end return end
CHECK: Here is a table of the value of sigma(n) for N = 1 through 10.
1 1 2 3 3 4 4 7 5 6 6 12 7 8 8 15 9 13 10 18
SUBMIT: Your file should be called "sigma.m", and begin with:
% sigma.m % YOUR NAME % This script (describe what it does)