31271 ÷ 3 = 10423 R2
Let's divide 31271 by 3.

Step 1:
3 goes into 3 1 times with a remainder of 0.
Write down 1 as next digit of of the result. 
Result so far: 1
Subtract 3 from 3 to get 0.
Bring next digit (1) of the dividend behind the 0 and repeat the process: 1 / 3

Step 2:
3 goes into 1 0 times with a remainder of 1.
Write down 0 as next digit of of the result. 
Result so far: 10
Subtract 0 from 1 to get 1.
Bring next digit (2) of the dividend behind the 1 and repeat the process: 12 / 3

Step 3:
3 goes into 12 4 times with a remainder of 0.
Write down 4 as next digit of of the result. 
Result so far: 104
Subtract 12 from 12 to get 0.
Bring next digit (7) of the dividend behind the 0 and repeat the process: 7 / 3

Step 4:
3 goes into 7 2 times with a remainder of 1.
Write down 2 as next digit of of the result. 
Result so far: 1042
Subtract 6 from 7 to get 1.
Bring next digit (1) of the dividend behind the 1 and repeat the process: 11 / 3

Step 5:
3 goes into 11 3 times with a remainder of 2.
Write down 3 as next digit of of the result. 
Result so far: 10423
Subtract 9 from 11 to get 2.

The final result is 10423 with a remainder of 2.