% harmonic: Determine how many terms of harmonic series sum to >= bound.
%
% Written by Paul Chew for CS100M, Feb 2006

disp('This program is excruciatingly slow for bounds above 20.')
bound = input('Specify bound: ');
sum = 0;
n = 0;
while sum < bound
    n = n + 1;
    sum = sum + 1/n;
end
fprintf('Bound %d was exceeded at term %d\n', bound, n);
