Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
func vdc(value, base=2) {
|
||||
while (value[-1] > 0) {
|
||||
value.append(value[-1] / base -> int);
|
||||
}
|
||||
var (x, sum) = (1, 0);
|
||||
value.each { |i|
|
||||
sum += ((i % base) / (x *= base));
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
2.to(5).each { |base|
|
||||
var seq = (10.range.map {|i| vdc([i], base) });
|
||||
"base %d: %s\n".printf(base, seq.map{|n| "%.4f" % n}.join(', '));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue