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

Advancing to step 1:
When dividing 3 by 40, we get 0 with a remainder of 3.
Use 0 as the next digit of our solution. 
Result so far: 0.0
Subtracting 0 from 3 leaves us with 3.
Include the next digit (9) from the dividend after 3, then repeat: 39 / 40

Let's proceed to step 2:
40 can be fit into 39 0 times, resulting in a remainder of 39.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
The remainder is 39 after subtracting 0 from 39.
Fetch the next digit (9) from the dividend, attach it to 39 and continue: 399 / 40

Advancing to step 3:
When dividing 399 by 40, we get 9 with a remainder of 39.
The number 9 becomes the next digit in our result. 
Result so far: 9.0
If we subtract 360 from 399, we get 39.
Take the next digit (1) from the dividend and append it to 39, then repeat: 391 / 40

Let's proceed to step 4:
If we divide 391 by 40, we get 9 and a remainder of 31.
Record the quotient 9 as the next digit in the result. 
Result so far: 99.0
Subtract 360 from 391 to get 31.
Bring next digit (1) of the dividend behind the 31 and repeat the process: 311 / 40

Let's proceed to step 5:
If we divide 311 by 40, we get 7 and a remainder of 31.
The number 7 becomes the next digit in our result. 
Result so far: 997.0
Subtracting 280 from 311 leaves us with 31.
Grab the next digit (5) from the dividend, add it to 31, then carry on: 315 / 40

Going ahead to step 6:
When dividing 315 by 40, we get 7 with a remainder of 35.
Use 7 as the next digit of our solution. 
Result so far: 9977.0
Subtract 280 from 315 to get 35.
Since there are no more digits in the dividend, we add a zero to the remainder making it 350, and continue the process.

Advancing to step 7:
If we divide 350 by 40, we get 8 and a remainder of 30.
Use 8 as the next digit of our solution. 
Result so far: 9977.8
Subtract 320 from 350 to 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 8:
When dividing 300 by 40, we get 7 with a remainder of 20.
Write down 7 as next digit of the result. 
Result so far: 9977.87
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.

Step 9:
When dividing 200 by 40, we get 5 with a remainder of 0.
Put 5 as the next digit of the answer. 
Result so far: 9977.875
Subtracting 200 from 200 leaves us with 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Going ahead to step 10:
0 divided by 40 is 0 with a remainder of 0.
The next digit of our result is 0. 
Result so far: 9977.875
Deduct 0 from 0 and we're left with 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

On to step 11:
40 goes into 0 0 times with a remainder of 0.
Use 0 as the next digit of our solution. 
Result so far: 9977.875
If we subtract 0 from 0, we get 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

The final outcome is 9977.875, with a leftover of 0.0.