RosettaCodeData/Task/Van-der-Corput-sequence/Jq/van-der-corput-sequence-2.jq
2017-09-25 22:28:19 +02:00

5 lines
217 B
Text

def round(n):
(if . < 0 then -1 else 1 end) as $s
| $s*10*.*n | if (floor%10)>4 then (.+5) else . end | ./10 | floor/n | .*$s;
range(2;6) | . as $base | "Base \(.): \( [ range(0;11) | vdc($base)|round(1000) ] )"