Ludic numbers: Difference between revisions

→‎{{header|Tcl}}: + standard ML
(Added Wren)
(→‎{{header|Tcl}}: + standard ML)
Line 3,663:
Ludic numbers 2000 to 2005: 21475 21481 21487 21493 21503 21511
Ludic triples below 250: (1 3 7) (5 7 11) (11 13 17) (23 25 29) (41 43 47) (173 175 179) (221 223 227) (233 235 239)
</pre>
 
=={{header|Standard ML}}==
<lang OCaml>
open List;
 
fun Ludi [] = []
| Ludi (T as h::L) =
let
fun next (h:: L ) =
let
val nw = #2 (ListPair.unzip (filter (fn (a,b) => a mod #2 h <> 0) L) )
in
ListPair.zip ( List.tabulate(List.length nw,fn i=>i) ,nw)
end
in
h :: Ludi ( next T)
end;
 
val ludics = 1:: (#2 (ListPair.unzip(Ludi (ListPair.zip ( List.tabulate(25000,fn i=>i),tabulate (25000,fn i=>i+2)) )) ));
 
app ((fn e => print (e^" ")) o Int.toString ) (take (ludics,25));
length (filter (fn e=> e <= 1000) ludics);
drop (take (ludics,2005),1999);
</lang>
output
<pre>
1 2 3 5 7 11 13 17 23 25 29 37 41 43 47 53 61 67 71 77 83 89 91 97 107 val it = () : unit
- val it = 142 : int
- val it = [21475,21481,21487,21493,21503,21511] : int list
</pre>
 
Anonymous user