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

Going ahead to step 1:
If we divide 7 by 40, we get 0 and a remainder of 7.
Use 0 as the next digit of our solution. 
Result so far: 0.0
Subtract 0 from 7 to get 7.
Bring next digit (7) of the dividend behind the 7 and repeat the process: 77 / 40

Let's proceed to step 2:
40 goes into 77 1 times with a remainder of 37.
Record the quotient 1 as the next digit in the result. 
Result so far: 1.0
If we take 40 away from 77, we end up with 37.
Append the next digit (8) from the dividend to 37 and continue with: 378 / 40

On to step 3:
The number 40 fits into 378 9 times, leaving a remainder of 18.
The next digit of our result is 9. 
Result so far: 19.0
Deduct 360 from 378 and we're left with 18.
Include the next digit (9) from the dividend after 18, then repeat: 189 / 40

Advancing to step 4:
40 goes into 189 4 times with a remainder of 29.
Record the quotient 4 as the next digit in the result. 
Result so far: 194.0
If we take 160 away from 189, we end up with 29.
Include the next digit (8) from the dividend after 29, then repeat: 298 / 40

On to step 5:
If we divide 298 by 40, we get 7 and a remainder of 18.
Write down 7 as next digit of the result. 
Result so far: 1947.0
Deduct 280 from 298 and we're left with 18.
Grab the next digit (7) from the dividend, add it to 18, then carry on: 187 / 40

Advancing to step 6:
40 can be fit into 187 4 times, resulting in a remainder of 27.
Write down 4 as next digit of the result. 
Result so far: 19474.0
If we take 160 away from 187, we end up with 27.
Since there are no more digits in the dividend, we add a zero to the remainder making it 270, and continue the process.

Let's proceed to step 7:
If we divide 270 by 40, we get 6 and a remainder of 30.
Write down 6 as next digit of the result. 
Result so far: 19474.6
If we take 240 away from 270, we end up 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.

Advancing to step 8:
When dividing 300 by 40, we get 7 with a remainder of 20.
Record the quotient 7 as the next digit in the result. 
Result so far: 19474.67
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.

Let's proceed to step 9:
200 divided by 40 is 5 with a remainder of 0.
Record the quotient 5 as the next digit in the result. 
Result so far: 19474.675
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.

Step 10:
40 can be fit into 0 0 times, resulting in a remainder of 0.
The next digit of our result is 0. 
Result so far: 19474.675
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.

Let's proceed to step 11:
When dividing 0 by 40, we get 0 with a remainder of 0.
The next digit of our result is 0. 
Result so far: 19474.675
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.

After the division, we end up with 19474.675 and a remainder of 0.0.