encodeBaseN :: [Char] -> Int-> [Char]
encodeBaseN c i 
  | i < clen = [c !! i] 
  | otherwise =  encodeBaseN c nextIndex  ++ [(c !! index)]
  where clen  = (length c)
        index = (mod i clen)
        nextIndex = (div (i - index) clen)
encodeBaseN :: [Char] -> Int-> [Char]
encodeBaseN c i 
  | i < clen = [c !! i] 
  | otherwise =  encodeBaseN c nextIndex  ++ [(c !! index)]
  where clen  = (length c)
        index = (mod i clen)
        nextIndex = (div (i - index) clen)
encodeBaseN c i 
  | i < clen = [c !! i] 
  | otherwise =  encodeBaseN c nextIndex  ++ [(c !! index)]
  where clen  = (length c)
        index = (mod i clen)
        nextIndex = (div (i - index) clen)