We divide 397158 by 31
Let's see how many times 31 fits into 397158.

Let's proceed to step 1:
3 divided by 31 is 0 with a remainder of 3.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
If we take 0 away from 3, we end up with 3.
Append the next digit (9) from the dividend to 3 and continue with: 39 / 31

Step 2:
The number 31 fits into 39 1 times, leaving a remainder of 8.
Write down 1 as next digit of the result. 
Result so far: 1.0
If we take 31 away from 39, we end up with 8.
Bring next digit (7) of the dividend behind the 8 and repeat the process: 87 / 31

Moving on to step 3:
If we divide 87 by 31, we get 2 and a remainder of 25.
Record the quotient 2 as the next digit in the result. 
Result so far: 12.0
Subtract 62 from 87 to get 25.
Take the next digit (1) from the dividend and append it to 25, then repeat: 251 / 31

Moving on to step 4:
If we divide 251 by 31, we get 8 and a remainder of 3.
The number 8 becomes the next digit in our result. 
Result so far: 128.0
Deduct 248 from 251 and we're left with 3.
Grab the next digit (5) from the dividend, add it to 3, then carry on: 35 / 31

On to step 5:
31 goes into 35 1 times with a remainder of 4.
Record the quotient 1 as the next digit in the result. 
Result so far: 1281.0
If we take 31 away from 35, we end up with 4.
Include the next digit (8) from the dividend after 4, then repeat: 48 / 31

On to step 6:
If we divide 48 by 31, we get 1 and a remainder of 17.
The next digit of our result is 1. 
Result so far: 12811.0
Deduct 31 from 48 and we're left with 17.
Since there are no more digits in the dividend, we add a zero to the remainder making it 170, and continue the process.

Step 7:
If we divide 170 by 31, we get 5 and a remainder of 15.
The number 5 becomes the next digit in our result. 
Result so far: 12811.5
Deduct 155 from 170 and we're left with 15.
Since there are no more digits in the dividend, we add a zero to the remainder making it 150, and continue the process.

Advancing to step 8:
When dividing 150 by 31, we get 4 with a remainder of 26.
Write down 4 as next digit of the result. 
Result so far: 12811.54
If we take 124 away from 150, we end up with 26.
Since there are no more digits in the dividend, we add a zero to the remainder making it 260, and continue the process.

Let's proceed to step 9:
260 divided by 31 is 8 with a remainder of 12.
Use 8 as the next digit of our solution. 
Result so far: 12811.548
Subtract 248 from 260 to get 12.
Since there are no more digits in the dividend, we add a zero to the remainder making it 120, and continue the process.

Step 10:
The number 31 fits into 120 3 times, leaving a remainder of 27.
Put 3 as the next digit of the answer. 
Result so far: 12811.5483
Subtracting 93 from 120 leaves us with 27.
Since there are no more digits in the dividend, we add a zero to the remainder making it 270, and continue the process.

Step 11:
270 divided by 31 is 8 with a remainder of 22.
Use 8 as the next digit of our solution. 
Result so far: 12811.54838
The remainder is 22 after subtracting 248 from 270.
Since there are no more digits in the dividend, we add a zero to the remainder making it 220, and continue the process.

On to step 12:
The number 31 fits into 220 7 times, leaving a remainder of 3.
The next digit of our result is 7. 
Result so far: 12811.548387
Subtract 217 from 220 to get 3.
Since there are no more digits in the dividend, we add a zero to the remainder making it 30, and continue the process.

Step 13:
If we divide 30 by 31, we get 0 and a remainder of 30.
Write down 0 as next digit of the result. 
Result so far: 12811.548387
Subtracting 0 from 30 leaves us with 30.
Since there are no more digits in the dividend, we add a zero to the remainder making it 300, and continue the process.

Moving on to step 14:
The number 31 fits into 300 9 times, leaving a remainder of 21.
Use 9 as the next digit of our solution. 
Result so far: 12811.54838709
Deduct 279 from 300 and we're left with 21.
Since there are no more digits in the dividend, we add a zero to the remainder making it 210, and continue the process.

The final result is 12811.54838709 with a remainder of 2.1e-08.