# Where to Send Your Employment Application

The encode function below was used to obscure part of the e-mail address to which you need to send your application. You need to decode that part of the e-mail address. This is not difficult to do by hand, but if you chose to seek machine help, we have supplied part of a decode function that you may find useful.

If you happened to use a language other than Haskell to decode the address, feel free to include your code with your application.

\begin{code}

import Data.Char (chr,ord)

address = decode cypherText ++ "@starling-software.com"

cypherText = [(10,5),(9,16),(10,9),(7,0),(7,2),(7,2),(7,6)]

decode :: [(Int,Int)] -> String
decode = map (chr.unsqrtmod)

unsqrtmod :: (Int,Int) -> Int
unsqrtmod (n,m) = undefined

encode :: String -> [(Int,Int)]
encode = map (sqrtmod.ord)

sqrtmod :: Int -> (Int,Int)
sqrtmod x = iter half
where
iter n | n2 <= x   = (n,x-n2)
| otherwise = iter (n-1)
where n2 = n*n
half = xdiv2 + xmod2

\end{code}