public class Bus
{
    // https://en.wikipedia.org/wiki/Chinese_remainder_theorem

    public Bus (long id, long index)
    {
        _id = id;
        _remainder = -index;

        System.out.println("initial rem "+_remainder);

        while (_remainder < 0)
        {
            _remainder += _id;
        }

        System.out.println("rem now "+_remainder);
    }

    public final long getRemainder ()
    {
        return _remainder;
    }

    // in this theorem implementation, id == mod
    
    public final long getID ()
    {
        return _id;
    }

    @Override
    public String toString ()
    {
        return "Bus "+_id+" remainder "+_remainder;
    }

    private long _id;
    private long _remainder;
}
@@ -171,64 +171,8 @@
 x;%0A%0A
-        System.out.println(%22initial rem %22+_remainder);%0A%0A
     
@@ -252,60 +252,8 @@
    %7D
-%0A%0A        System.out.println(%22rem now %22+_remainder);
 %0A   
@@ -383,20 +383,16 @@
  == mod%0A
-    
 %0A    pub

Update Bus.java