Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 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
|
||||
}
|
||||
|
||||
for base in (2..5) {
|
||||
var seq = 10.of {|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