/* * Return the _n_th term of the van der Corput sequence. * Uses the current _ibase_. */ define v(n) { auto c, r, s s = scale scale = 0 /* to use integer division */ /* * c = count digits of n * r = reverse the digits of n */ for (0; n != 0; n /= 10) { c += 1 r = (10 * r) + (n % 10) } /* move radix point to left of digits */ scale = length(r) + 6 r /= 10 ^ c scale = s return r } t = 10 for (b = 2; b <= 4; b++) { "base "; b obase = b for (i = 0; i < 10; i++) { ibase = b " "; v(i) ibase = t } obase = t } quit