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,23 @@
func binprime(p) {
p >= 2 || return false
for i in (1 .. p>>1) {
(binomial(p, i) % p) && return false
}
return true
}
func coef(n, e) {
(e == 0) && return "#{n}"
(n == 1) && (n = "")
(e == 1) ? "#{n}x" : "#{n}x^#{e}"
}
func binpoly(p) {
join(" ", coef(1, p), ^p -> map {|i|
join(" ", %w(+ -)[(p-i)&1], coef(binomial(p, i), i))
}.reverse...)
}
say "expansions of (x-1)^p:"
for i in ^10 { say binpoly(i) }
say "Primes to 80: [#{2..80 -> grep { binprime(_) }.join(' ')}]"