Yes, the operation div 3 converts the series 0,1,2,3,4,5,6,7,8,9,10,11,12,... to blocks of 3 numbers: 0,0,0,1,1,1,2,2,3,4,4,4,...
But you have only 3 colors, i.e. the block with the div resulting in 0 gets the first color, the block with the result 1 gets the second color, the block with the result 2 gets the third color, but: the block with the result 3 should get color 0 again etc. This means that you must convert the sequence 0,0,0,1,1,1,2,2,3,4,4,4,... to 0,0,0,1,1,1,2,2,2,0,0,0,1,1,1,...
Which operation do you need for this?