calcE :: Int -> Rational
calcE n = calcE' 0
  where 
    calcE' :: Int -> Rational
    calcE' i = cur + next 
        where 
          cur 
            | i == 0 = 2 
            | (i + 1) `mod` 3 == 0 = fromIntegral ((i + 1) `div` 3) * 2  
            | otherwise = 1                
            
          next = if n == (i + 1) then 0 else 1 / calcE' (i + 1)
calcE :: Int -> Rational
calcE n = calcE' 0
  where 
    calcE' :: Int -> Rational
    calcE' i = cur + next 
        where 
          cur 
            | i == 0 = 2 
            | (i + 1) `mod` 3 == 0 = fromIntegral ((i + 1) `div` 3) * 2  
            | otherwise = 1                
            
          next = if n == (i + 1) then 0 else 1 / calcE' (i + 1)
calcE n = calcE' 0
  where 
    calcE' :: Int -> Rational
    calcE' i = cur + next 
        where 
          cur 
            | i == 0 = 2 
            | (i + 1) `mod` 3 == 0 = fromIntegral ((i + 1) `div` 3) * 2  
            | otherwise = 1                
            
          next = if n == (i + 1) then 0 else 1 / calcE' (i + 1)