Task: Van der Corput sequence
C#: using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VanDerCorput
{
    
    
    
    
    
    
    
    
    
    
    
    
    public class VanDerCorputSequence: IEnumerable<Tuple<long,long>>
    {
        
        
        
        public int Base { get; private set; }

        
        
        
        public long Count { get; private set; }

        
        
        
        
        
        public VanDerCorputSequence(int iBase, long count = long.MaxValue) {
            if (iBase < 2)
                throw new ArgumentOutOfRangeException("iBase", "must be two or greater, not the given value of " + iBase);
            Base = iBase;
            Count = count;
        }

        
        
        
        
        
        
        public Tuple<long,long> Compute(long n)
        {
            long p = 0, q = 1;
            long numerator, denominator;
            while (n != 0)
            {
                p = p * Base + (n % Base);
                q *= Base;
                n /= Base;
            }
            numerator = p;
            denominator = q;
            while (p != 0) 
            { 
                n = p; 
                p = q % p; 
                q = n; 
            }
            numerator /= q;
            denominator /= q;
            return new Tuple<long,long>(numerator, denominator);
        }

        
        
        
        
        
        
        public static Tuple<long, long> Compute(int iBase, long n)
        {
            var seq = new VanDerCorputSequence(iBase);
            return seq.Compute(n);
        }

        
        
        
        
        
        public IEnumerator<Tuple<long, long>> GetEnumerator()
        {
            long iSequenceIndex = 0L;
            while (iSequenceIndex < Count)
            {
                yield return Compute(iSequenceIndex);
                iSequenceIndex++;
            }
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            TestBasesTwoThroughFive();

            Console.WriteLine("Type return to continue...");
            Console.ReadLine();
        }

        static void TestBasesTwoThroughFive()
        {
            foreach (var seq in Enumerable.Range(2, 5).Select(x => new VanDerCorputSequence(x, 10))) 
            {
                Console.Write("base " + seq.Base + ":");
                foreach(var vc in seq) 
                    Console.Write(" " + vc.Item1 + "/" + vc.Item2);
                Console.WriteLine();
            }
        }
    }
}

VB: Private Function vdc(ByVal n As Integer, BASE As Variant) As Variant
    Dim res As String
    Dim digit As Integer, g As Integer, denom As Integer
    denom = 1
    Do While n
        denom = denom * BASE
        digit = n Mod BASE
        n = n \ BASE
        res = res & CStr(digit) 
    Loop
    vdc = IIf(Len(res) = 0, "0", "0." & res)
End Function
 
Public Sub show_vdc()
    Dim v As Variant, j As Integer
    For i = 2 To 5
        Debug.Print "Base "; i; ": ";
        For j = 0 To 9
            v = vdc(j, i)
            Debug.Print v; " ";
        Next j
        Debug.Print
    Next i
End Sub