We look at the division of 31551 by 40 
The aim is to understand the frequency of 40 in 31551.

Going ahead to step 1:
When dividing 3 by 40, we get 0 with a remainder of 3.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
Subtracting 0 from 3 leaves us with 3.
Include the next digit (1) from the dividend after 3, then repeat: 31 / 40

Let's proceed to step 2:
40 can be fit into 31 0 times, resulting in a remainder of 31.
Record the quotient 0 as the next digit in the result. 
Result so far: 0.0
If we subtract 0 from 31, we get 31.
Grab the next digit (5) from the dividend, add it to 31, then carry on: 315 / 40

Going ahead to step 3:
The number 40 fits into 315 7 times, leaving a remainder of 35.
Write down 7 as next digit of the result. 
Result so far: 7.0
The remainder is 35 after subtracting 280 from 315.
Take the next digit (5) from the dividend and append it to 35, then repeat: 355 / 40

Step 4:
355 divided by 40 is 8 with a remainder of 35.
Record the quotient 8 as the next digit in the result. 
Result so far: 78.0
If we take 320 away from 355, we end up with 35.
Bring next digit (1) of the dividend behind the 35 and repeat the process: 351 / 40

On to step 5:
40 goes into 351 8 times with a remainder of 31.
The next digit of our result is 8. 
Result so far: 788.0
Deduct 320 from 351 and we're left with 31.
Since there are no more digits in the dividend, we add a zero to the remainder making it 310, and continue the process.

Moving on to step 6:
The number 40 fits into 310 7 times, leaving a remainder of 30.
Put 7 as the next digit of the answer. 
Result so far: 788.7
If we subtract 280 from 310, we get 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 7:
40 can be fit into 300 7 times, resulting in a remainder of 20.
The next digit of our result is 7. 
Result so far: 788.77
If we take 280 away from 300, we end up with 20.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

The quotient of the division is 788.77, and the remainder is 0.02.