function numOfElements = harmonicSeries(sum)
% HARMONICSERIES  calculates the number of elements of  a harmonic series
% needed to reach the sum passed as a parameter
s=0;
i=1;
while s < sum
     s=s+1/i;
     i=i+1;
end
numOfElements = i;
return
end
