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

Moving on to step 1:
When dividing 3 by 40, we get 0 with a remainder of 3.
Write down 0 as next digit of the result. 
Result so far: 0.0
If we subtract 0 from 3, we get 3.
Append the next digit (3) from the dividend to 3 and continue with: 33 / 40

Step 2:
When dividing 33 by 40, we get 0 with a remainder of 33.
Use 0 as the next digit of our solution. 
Result so far: 0.0
Subtracting 0 from 33 leaves us with 33.
Include the next digit (1) from the dividend after 33, then repeat: 331 / 40

Going ahead to step 3:
40 goes into 331 8 times with a remainder of 11.
Use 8 as the next digit of our solution. 
Result so far: 8.0
Subtract 320 from 331 to get 11.
Include the next digit (7) from the dividend after 11, then repeat: 117 / 40

Step 4:
If we divide 117 by 40, we get 2 and a remainder of 37.
The next digit of our result is 2. 
Result so far: 82.0
Deduct 80 from 117 and we're left with 37.
Take the next digit (4) from the dividend and append it to 37, then repeat: 374 / 40

On to step 5:
When dividing 374 by 40, we get 9 with a remainder of 14.
The next digit of our result is 9. 
Result so far: 829.0
Subtract 360 from 374 to get 14.
Bring next digit (4) of the dividend behind the 14 and repeat the process: 144 / 40

On to step 6:
40 goes into 144 3 times with a remainder of 24.
The next digit of our result is 3. 
Result so far: 8293.0
Subtract 120 from 144 to get 24.
Since there are no more digits in the dividend, we add a zero to the remainder making it 240, and continue the process.

Moving on to step 7:
The number 40 fits into 240 6 times, leaving a remainder of 0.
The next digit of our result is 6. 
Result so far: 8293.6
Subtract 240 from 240 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 8:
The number 40 fits into 0 0 times, leaving a remainder of 0.
Record the quotient 0 as the next digit in the result. 
Result so far: 8293.6
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 9:
When dividing 0 by 40, we get 0 with a remainder of 0.
The next digit of our result is 0. 
Result so far: 8293.6
Subtracting 0 from 0 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.

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