Skip to content

Instantly share code, notes, and snippets.

@yukitos
Last active June 22, 2017 07:22
Show Gist options
  • Save yukitos/4d1fd44b2fb422895528f9009f1a2e38 to your computer and use it in GitHub Desktop.
Save yukitos/4d1fd44b2fb422895528f9009f1a2e38 to your computer and use it in GitHub Desktop.
let rot n (s:string) = (s + s).Substring(n, s.Length)
let tonum (c:char) = ((int c - int 'A') * 5 + 15) % 26
let conv s = s |> rot 2 |> Seq.map tonum |> Seq.fold (fun a c -> a + (sprintf "%02d" c)) ""
let test s =
printfn "%s -> %s" s (conv s)
test "CAT"
test "DOG"
test "EULER"
test "RIEMANN"
test "EUCLIDES"
test "PITAGORAS"
test "FERMAT"
CAT -> 062515
DOG -> 190407
EULER -> 1809220911
RIEMANN -> 09231502022203
EUCLIDES -> 2518030409010911
PITAGORAS -> 061519072215011203
FERMAT -> 222315061409
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment