Originally Posted by

**GClements**
That's because it's spam (which I've reported); it's just an attempt to raise the page ranking for the link.

If you want a definitive answer to your original question, you're just going to have to test the various methods to see which turns out to be the fastest. A lookup table is one option, but that may end up being slower than just using quotient and remainder. Another option is to perform division using multiply and shift:

x/y = ((x+1)*floor(2^{k}/y))>>k for sufficiently large k (k=16 works for both 3^5 and 5^3).

x%y = x-y*(x/y)

Using vector operations (e.g. x/ivec4(3,9,27,81)) may be faster than separate calculations, or it may not.