Starling Software K.K Language:

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.


import Data.Char (chr,ord)

address = decode cypherText ++ ""

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
        iter n | n2 <= x   = (n,x-n2)
               | otherwise = iter (n-1)
               where n2 = n*n
        half = x`div`2 + x`mod`2