Let's divide 879777 by 40
The aim is to understand the frequency of 40 in 879777.

Step 1:
If we divide 8 by 40, we get 0 and a remainder of 8.
Put 0 as the next digit of the answer. 
Result so far: 0.0
The remainder is 8 after subtracting 0 from 8.
Grab the next digit (7) from the dividend, add it to 8, then carry on: 87 / 40

Advancing to step 2:
If we divide 87 by 40, we get 2 and a remainder of 7.
The number 2 becomes the next digit in our result. 
Result so far: 2.0
Subtracting 80 from 87 leaves us with 7.
Fetch the next digit (9) from the dividend, attach it to 7 and continue: 79 / 40

Let's proceed to step 3:
79 divided by 40 is 1 with a remainder of 39.
The number 1 becomes the next digit in our result. 
Result so far: 21.0
If we subtract 40 from 79, we get 39.
Grab the next digit (7) from the dividend, add it to 39, then carry on: 397 / 40

Step 4:
The number 40 fits into 397 9 times, leaving a remainder of 37.
Use 9 as the next digit of our solution. 
Result so far: 219.0
The remainder is 37 after subtracting 360 from 397.
Fetch the next digit (7) from the dividend, attach it to 37 and continue: 377 / 40

Advancing to step 5:
If we divide 377 by 40, we get 9 and a remainder of 17.
The number 9 becomes the next digit in our result. 
Result so far: 2199.0
If we subtract 360 from 377, we get 17.
Grab the next digit (7) from the dividend, add it to 17, then carry on: 177 / 40

Step 6:
177 divided by 40 is 4 with a remainder of 17.
Put 4 as the next digit of the answer. 
Result so far: 21994.0
If we subtract 160 from 177, we get 17.
Since there are no more digits in the dividend, we add a zero to the remainder making it 170, and continue the process.

Moving on to step 7:
40 goes into 170 4 times with a remainder of 10.
Put 4 as the next digit of the answer. 
Result so far: 21994.4
If we take 160 away from 170, we end up with 10.
Since there are no more digits in the dividend, we add a zero to the remainder making it 100, and continue the process.

Step 8:
40 goes into 100 2 times with a remainder of 20.
The next digit of our result is 2. 
Result so far: 21994.42
The remainder is 20 after subtracting 80 from 100.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

Advancing to step 9:
If we divide 200 by 40, we get 5 and a remainder of 0.
Write down 5 as next digit of the result. 
Result so far: 21994.425
If we take 200 away from 200, we end up 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.

Moving on to step 10:
If we divide 0 by 40, we get 0 and a remainder of 0.
Record the quotient 0 as the next digit in the result. 
Result so far: 21994.425
If we take 0 away from 0, we end up 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 11:
If we divide 0 by 40, we get 0 and a remainder of 0.
Put 0 as the next digit of the answer. 
Result so far: 21994.425
If we take 0 away from 0, we end up 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.

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