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

On to step 1:
If we divide 3 by 40, we get 0 and a remainder of 3.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
If we subtract 0 from 3, we get 3.
Grab the next digit (3) from the dividend, add it to 3, then carry on: 33 / 40

Let's proceed to step 2:
When dividing 33 by 40, we get 0 with a remainder of 33.
The next digit of our result is 0. 
Result so far: 0.0
Subtract 0 from 33 to get 33.
Grab the next digit (6) from the dividend, add it to 33, then carry on: 336 / 40

Advancing to step 3:
336 divided by 40 is 8 with a remainder of 16.
Write down 8 as next digit of the result. 
Result so far: 8.0
Deduct 320 from 336 and we're left with 16.
Grab the next digit (0) from the dividend, add it to 16, then carry on: 160 / 40

Moving on to step 4:
If we divide 160 by 40, we get 4 and a remainder of 0.
Put 4 as the next digit of the answer. 
Result so far: 84.0
Subtract 160 from 160 to get 0.
Include the next digit (8) from the dividend after 0, then repeat: 8 / 40

Moving on to step 5:
40 can be fit into 8 0 times, resulting in a remainder of 8.
Put 0 as the next digit of the answer. 
Result so far: 840.0
The remainder is 8 after subtracting 0 from 8.
Bring next digit (7) of the dividend behind the 8 and repeat the process: 87 / 40

Going ahead to step 6:
If we divide 87 by 40, we get 2 and a remainder of 7.
Write down 2 as next digit of the result. 
Result so far: 8402.0
If we take 80 away from 87, we end up with 7.
Since there are no more digits in the dividend, we add a zero to the remainder making it 70, and continue the process.

Let's proceed to step 7:
The number 40 fits into 70 1 times, leaving a remainder of 30.
Write down 1 as next digit of the result. 
Result so far: 8402.1
Subtracting 40 from 70 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.

On to step 8:
If we divide 300 by 40, we get 7 and a remainder of 20.
Put 7 as the next digit of the answer. 
Result so far: 8402.17
The remainder is 20 after subtracting 280 from 300.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

On to step 9:
40 goes into 200 5 times with a remainder of 0.
The number 5 becomes the next digit in our result. 
Result so far: 8402.175
Subtract 200 from 200 to 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.

On to step 10:
40 goes into 0 0 times with a remainder of 0.
Use 0 as the next digit of our solution. 
Result so far: 8402.175
The remainder is 0 after subtracting 0 from 0.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Advancing to step 11:
The number 40 fits into 0 0 times, leaving a remainder of 0.
The next digit of our result is 0. 
Result so far: 8402.175
Subtract 0 from 0 to 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 8402.175, with a leftover of 0.0.