function output_sum = task_one(start_element_value, end_element_index, constant) %% HOW TO % start_element_value - first a element % end_element_index - n (how many values of elements we should calculate) % constans - m constans added to each elemect according to formula: % a(n)=a(n-1)+m % output - vector with calculeted elements % element - current callculeted element %% MAIN CODE output(1,1) = start_element_value ; element = output(1,1); % Initialization of a1 for step=2:1:end_element_index % calculations starts for a2 element element = element + constant; % a(n) = a(n-1) + m output(1, step) = element; % append calculated value on an index end output_sum = sum(output); end