Last active
June 22, 2017 07:22
-
-
Save yukitos/4d1fd44b2fb422895528f9009f1a2e38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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