We're dividing 31787 by 31 
The aim is to understand the frequency of 31 in 31787.

Let's proceed to step 1:
If we divide 3 by 31, we get 0 and a remainder of 3.
Write down 0 as next digit of the result. 
Result so far: 0.0
Deduct 0 from 3 and we're left with 3.
Bring next digit (1) of the dividend behind the 3 and repeat the process: 31 / 31

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

Going ahead to step 3:
31 can be fit into 7 0 times, resulting in a remainder of 7.
Use 0 as the next digit of our solution. 
Result so far: 10.0
If we subtract 0 from 7, we get 7.
Take the next digit (8) from the dividend and append it to 7, then repeat: 78 / 31

Let's proceed to step 4:
When dividing 78 by 31, we get 2 with a remainder of 16.
The next digit of our result is 2. 
Result so far: 102.0
If we subtract 62 from 78, we get 16.
Fetch the next digit (7) from the dividend, attach it to 16 and continue: 167 / 31

On to step 5:
31 goes into 167 5 times with a remainder of 12.
The next digit of our result is 5. 
Result so far: 1025.0
Subtract 155 from 167 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.

Let's proceed to step 6:
120 divided by 31 is 3 with a remainder of 27.
Use 3 as the next digit of our solution. 
Result so far: 1025.3
Subtract 93 from 120 to get 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 7:
The number 31 fits into 270 8 times, leaving a remainder of 22.
The number 8 becomes the next digit in our result. 
Result so far: 1025.38
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.

Going ahead to step 8:
220 divided by 31 is 7 with a remainder of 3.
Use 7 as the next digit of our solution. 
Result so far: 1025.387
If we take 217 away from 220, we end up with 3.
Since there are no more digits in the dividend, we add a zero to the remainder making it 30, and continue the process.

Let's proceed to step 9:
31 can be fit into 30 0 times, resulting in a remainder of 30.
Record the quotient 0 as the next digit in the result. 
Result so far: 1025.387
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 10:
If we divide 300 by 31, we get 9 and a remainder of 21.
The next digit of our result is 9. 
Result so far: 1025.38709
Subtract 279 from 300 to get 21.
Since there are no more digits in the dividend, we add a zero to the remainder making it 210, and continue the process.

Let's proceed to step 11:
31 can be fit into 210 6 times, resulting in a remainder of 24.
Put 6 as the next digit of the answer. 
Result so far: 1025.387096
If we subtract 186 from 210, we get 24.
Since there are no more digits in the dividend, we add a zero to the remainder making it 240, and continue the process.

Step 12:
31 goes into 240 7 times with a remainder of 23.
Record the quotient 7 as the next digit in the result. 
Result so far: 1025.3870967
Subtract 217 from 240 to get 23.
Since there are no more digits in the dividend, we add a zero to the remainder making it 230, and continue the process.

Going ahead to step 13:
When dividing 230 by 31, we get 7 with a remainder of 13.
Put 7 as the next digit of the answer. 
Result so far: 1025.38709677
The remainder is 13 after subtracting 217 from 230.
Since there are no more digits in the dividend, we add a zero to the remainder making it 130, and continue the process.

The final outcome is 1025.38709677, with a leftover of 1.3e-08.