You can see the problem here: Problem #65.

A simple problem. The fraction can be iteratively worked from bottom to top with the following functions:

• n(x) = d(x – 1)
• d(x) = n(x – 1) + d(x – 1) * (the current addend)

The above two functions just describe how to reduce the fractions in the problem. I will use $1 + \cfrac{1}{2 + \cfrac{1}{2 + \cfrac{1}{2}}}$ as an example. Starting from the bottom, multiply $\cfrac{1}{2 + \cfrac{1}{2}}$ by 2 gives $\dfrac{2}{4 + 1}$ or $\dfrac{2}{5}$. This gives the next fraction as $\cfrac{1}{2 + \cfrac{2}{5}}$. Multiply that by 5 (the inner denominator), you get $\dfrac{5}{12}$. I implemented the above steps as a function. Turns out the numerator even overflowed long, so I cheated and used the BigInteger class.

Getting the numerator and add its digits together:

```int[] addends = new int[99];

//could just code it by hand, but Java already provide a utility class, so...

//get the 2, 4, 6, 8... in the addends
for (int i = 1, j = 2; i &lt; addends.length; i += 3, j += 2) {
}

//get the numerator
int sum = 0;
for (int i = 0, len = number.length(); i &lt; len; ++i) {
//-48 convert a char digit to the actual digit (i.e. '0' -&gt; 0), Unicode is fun
sum += number.charAt(i) - 48;
}
System.out.println(sum);
```

The .continuedBigFractionNumerator() function:

```private static BigInteger continuedBigFractionNumerator(int base, int[] addends) {
BigInteger numer = BigInteger.ONE,
denom = new BigInteger(String.valueOf(addends[len - 1])),
tempNumer;

for (int i = len - 2; i &gt;= 0; --i) {
tempNumer = numer;
numer = denom;