Created
September 8, 2012 16:10
-
-
Save athas/3676565 to your computer and use it in GitHub Desktop.
1i3
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
(* Lidt ændret type... *) | |
fun relativePrime 0 q = q = 1 | |
| relativePrime p q = relativePrime (q mod p) p; | |
(* Og en hjælpefunktion der allerede burde være i SML...*) | |
fun range (from,to) = List.tabulate(to-from+1, fn x => x + from); | |
(* Så kan den skrives abstrakt. *) | |
fun nextNotRelativePrime p = | |
Option.getOpt (List.find (not o relativePrime p) (range(p+1,p*2-1)), | |
p*2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment