Errrrh, I had a look in an old maths book I have, and theres an easier way than all that "casting out nines" and base 4 stuff I told you about earlier: Apparently if you add the digits of the number to be tested, sucessively until theres only 1 digit left, then if, and only if, the result is 3 or 6 or 9 then the original number was divisible by 3. e.g. Is 12345 divisible by 3? 1+2+3+4+5 = 15 1+5 = 6 so yes 12345 is divisible by 3. Now, about that code... -- erik