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,3 @@
func left_fact(k) {
^k -> map {|n| n! } -> sum(0)
}

View file

@ -0,0 +1,3 @@
func left_fact(k) {
^k -> reduce { |a,b| a + b! } + 1
}

View file

@ -0,0 +1,18 @@
func left_fact(n) {
static cached = 0
static factorial = 1
static leftfact = 0
 
if (n < cached) {
cached = 0
factorial = 1
leftfact = 0
}
 
while (n > cached) {
leftfact += factorial
factorial *= ++cached
}
 
leftfact
}

View file

@ -0,0 +1,9 @@
for r in [range(0, 10), range(20, 110).by(10)] {
for i in r {
printf("!%d = %s\n", i, left_fact(i));
}
}
for i in range(1000, 10000).by(1000) {
printf("!%d has %d digits.\n", i, left_fact(i).len);
}