166317 divided by 40 
The aim is to understand the frequency of 40 in 166317.

Going ahead to step 1:
1 divided by 40 is 0 with a remainder of 1.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
If we take 0 away from 1, we end up with 1.
Include the next digit (6) from the dividend after 1, then repeat: 16 / 40

Let's proceed to step 2:
16 divided by 40 is 0 with a remainder of 16.
The next digit of our result is 0. 
Result so far: 0.0
Subtracting 0 from 16 leaves us with 16.
Bring next digit (6) of the dividend behind the 16 and repeat the process: 166 / 40

Moving on to step 3:
The number 40 fits into 166 4 times, leaving a remainder of 6.
Use 4 as the next digit of our solution. 
Result so far: 4.0
Subtracting 160 from 166 leaves us with 6.
Append the next digit (3) from the dividend to 6 and continue with: 63 / 40

Going ahead to step 4:
If we divide 63 by 40, we get 1 and a remainder of 23.
The next digit of our result is 1. 
Result so far: 41.0
Subtract 40 from 63 to get 23.
Bring next digit (1) of the dividend behind the 23 and repeat the process: 231 / 40

On to step 5:
If we divide 231 by 40, we get 5 and a remainder of 31.
The next digit of our result is 5. 
Result so far: 415.0
Deduct 200 from 231 and we're left with 31.
Include the next digit (7) from the dividend after 31, then repeat: 317 / 40

Step 6:
When dividing 317 by 40, we get 7 with a remainder of 37.
The next digit of our result is 7. 
Result so far: 4157.0
Deduct 280 from 317 and we're left with 37.
Since there are no more digits in the dividend, we add a zero to the remainder making it 370, and continue the process.

Let's proceed to step 7:
40 goes into 370 9 times with a remainder of 10.
Put 9 as the next digit of the answer. 
Result so far: 4157.9
The remainder is 10 after subtracting 360 from 370.
Since there are no more digits in the dividend, we add a zero to the remainder making it 100, and continue the process.

Advancing to step 8:
40 goes into 100 2 times with a remainder of 20.
Use 2 as the next digit of our solution. 
Result so far: 4157.92
Subtracting 80 from 100 leaves us 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.

Moving on to step 9:
If we divide 200 by 40, we get 5 and a remainder of 0.
The next digit of our result is 5. 
Result so far: 4157.925
The remainder is 0 after subtracting 200 from 200.
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:
40 can be fit into 0 0 times, resulting in a remainder of 0.
Write down 0 as next digit of the result. 
Result so far: 4157.925
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:
40 goes into 0 0 times with a remainder of 0.
Write down 0 as next digit of the result. 
Result so far: 4157.925
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.

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