Remember drawing lines on a number line, when you were first learning about numbers? Here's a twist on that (Salkind, 1952):

Suppose a line is $1$ inch long (exists between 0 and 1 on the x-axis of your number line). It grows toward the right according to:

$1+\frac{1}{4}\sqrt{2}+\frac{1}{4}+\frac{1}{16}\sqrt{2}+\frac{1}{16}+\frac{1}{64}\sqrt{2}+\frac{1}{64}+...$

If this growth process goes on forever, how long will the line become? Your choices are:

A. $\infty$

B. $\frac{4}{3}$

C. $\frac{8}{3}$

D. $\frac{1}{3}(4+\sqrt{2})$

E. $\frac{2}{3}(4+\sqrt{2})$

What's your answer? (A-E)?

Suppose a line is $1$ inch long (exists between 0 and 1 on the x-axis of your number line). It grows toward the right according to:

$1+\frac{1}{4}\sqrt{2}+\frac{1}{4}+\frac{1}{16}\sqrt{2}+\frac{1}{16}+\frac{1}{64}\sqrt{2}+\frac{1}{64}+...$

If this growth process goes on forever, how long will the line become? Your choices are:

A. $\infty$

B. $\frac{4}{3}$

C. $\frac{8}{3}$

D. $\frac{1}{3}(4+\sqrt{2})$

E. $\frac{2}{3}(4+\sqrt{2})$

What's your answer? (A-E)?

Type your code here:

See your results here:

First, try to see the pattern in the terms after the $1+$.

Next, if you can run a for-loop from 1 to some-number-of-terms (in
the variable, `i`

, how could you work `i`

(=1,2,3,4,5, etc.) into this pattern?

In the starter code above,
we're calling the changing denominator in the pattern `d`

. Fix the `d=`

line, then use it to program
in the formula after the `sum=sum+`

line to starting adding up the terms.