Add tasks for all the new languages

This commit is contained in:
Tina Müller 2016-12-05 23:44:36 +01:00
parent 9dc3c2bb62
commit bba7bfd280
13208 changed files with 134745 additions and 0 deletions

View file

@ -0,0 +1,18 @@
fun kprime(n: int, k: int): bool =
let (p,f) = (2, 0)
loop ((n, p, f)) = while f < k && p*p <= n do
loop ((n,f)) = while 0 == n % p do
(n/p, f+1)
in (n, p+1, f)
in f + (if n > 1 then 1 else 0) == k
fun main(m: int): [][]int =
map (fn k: [10]int =>
let ps = replicate 10 0
loop ((i,c,ps) = (2,0,ps)) = while c < 10 do
if kprime(i,k) then
unsafe let ps[c] = i
in (i+1, c+1, ps)
else (i+1, c, ps)
in ps)
(map (1+) (iota m))