In Project Euler, a problem asks me to write a program to find the convergence value of 20 terms from the Harmonic sequence:
1/111, 1/222, 1/333, 1/444, 1/555, 1/666, 1/777, 1/888, 1/999, 1/1000, 1/1110, 1/1111, 1/1112, 1/1113, 1/1114, 1/1115, 1/1116, 1/1117, 1/1118, and 1/1119
I want to write the program myself to solve the problem, however, not having dealt with Calc II, I had to read up on Divergence/Convergence. All the explanations deal with series that can be represented by a formula. This series, as far as I can tell, cannot.
So, the question is:
Is there a formula to represent this series or is there a method for finding the convergence of this series without a formula?
If you read the problem carefully you will notice that there is in fact a formula. The sequence you're dealing with is a harmonic series, from which terms having 3 or more equal consecutive digits have been removed. Brute force approach here would be to sum all terms of harmonic series omitting those specified until required precision is reached. Ruby with its Rational
class seems really fine candidate to that.