First,  
    we increase the precision .  
        For convenience we will not go too high now, 
    but it is good to know how to . 

To compile a line,  
    click on that line and press SHIFT - ENTER,  
    holding down both keys at once .  ONLY press SHIFT - 
        ENTER on the non - 
        explanation lines .  
            Please execute the lines in the order they occur . 



$MaxExtraPrecision  =  2000000

This loads in the ContinuedFraction package .  I' m not sure if it is default loaded,  
    so it is probably best to load it

<< NumberTheory`ContinuedFractions`

we now define Num,  
    just to show how to define constants

Num  =  200

We let a be an array of the first Num digits of the continued fraction expansion of E  =  2.718281828 ...  ..  Remember,  
    in mathematica if you want to access the nth element of the array a you access it by a[[n]] -- you must use double brackets.

a  =  ContinuedFraction[E,  Num]

c will be used to count certain occurances;  we initialize it to 0, 
    0. 


    c  =  {0, 0}

below is an example of how to use a for loop and an if loop .  
          the Count function counts how many elements of the array a equal i .  We use an IF - THEN - 
      ELSE below .  If a[
          i] is between 9 and 20 we increment c[[1]] by one,  
    else we increment c[[2]] by one.

\(\(\(For[\ i = 1, 
      i ≤ Num, \(i++\), \(\(b[i] = Count[a, i];\)

      \(If[\((a[\([i]\)] > 9)\) && \((a[\([i]\)] < 20)\), 
          c[\([1]\)] = c[\([1]\)] + 1, 
          c[\([2]\)] = c[\([2]\)] + 1];\)\)
]\)\(
\)
    \)\)

we  now print the results.

\(\(\(For[i = 1, i ≤ 10, \(i++\), Print[b[i]]]\)\(
\)
    \)\)

\(\(\(Print[c[\([1]\)]]\)\(
\)
    \)\)

\(\(\(Print[c[\([2]\)]]\)\(
\)
    \)\)