works for all unsigned ints x (32-bit) that are less than 98303.

And you can implement the multiplication using bitwise operators too... (note that 43691 == 0xaaab, or 1010101010101011 in binary, and the reason this works is that (1 << 17) / 3 == 0xaaaa).

unsigned int divthree(unsigned int x) {
unsigned int y;
y = x << 1;
y += y << 2;
y += y << 4;
y += y << 8;
y += x;
return (y >> 17);
}

If you can use 64-bit integers, you could write the following, which works on all unsigned 32-bit ints.

unsigned int divthree(unsigned int x) {
unsigned long long y;
y = x << 1;
y += y << 2;
y += y << 4;
y += y << 8;
y += y << 16;
y += x;
return (y >> 33);
}