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

Advancing to step 1:
5 divided by 40 is 0 with a remainder of 5.
The next digit of our result is 0. 
Result so far: 0.0
Deduct 0 from 5 and we're left with 5.
Take the next digit (9) from the dividend and append it to 5, then repeat: 59 / 40

On to step 2:
When dividing 59 by 40, we get 1 with a remainder of 19.
The next digit of our result is 1. 
Result so far: 1.0
Subtract 40 from 59 to get 19.
Bring next digit (3) of the dividend behind the 19 and repeat the process: 193 / 40

Let's proceed to step 3:
The number 40 fits into 193 4 times, leaving a remainder of 33.
Put 4 as the next digit of the answer. 
Result so far: 14.0
If we subtract 160 from 193, we get 33.
Include the next digit (9) from the dividend after 33, then repeat: 339 / 40

Advancing to step 4:
339 divided by 40 is 8 with a remainder of 19.
The number 8 becomes the next digit in our result. 
Result so far: 148.0
Subtract 320 from 339 to get 19.
Fetch the next digit (7) from the dividend, attach it to 19 and continue: 197 / 40

Moving on to step 5:
197 divided by 40 is 4 with a remainder of 37.
Use 4 as the next digit of our solution. 
Result so far: 1484.0
Subtracting 160 from 197 leaves us with 37.
Include the next digit (1) from the dividend after 37, then repeat: 371 / 40

On to step 6:
If we divide 371 by 40, we get 9 and a remainder of 11.
Put 9 as the next digit of the answer. 
Result so far: 14849.0
If we take 360 away from 371, we end up with 11.
Since there are no more digits in the dividend, we add a zero to the remainder making it 110, and continue the process.

Let's proceed to step 7:
110 divided by 40 is 2 with a remainder of 30.
Put 2 as the next digit of the answer. 
Result so far: 14849.2
If we subtract 80 from 110, we get 30.
Since there are no more digits in the dividend, we add a zero to the remainder making it 300, and continue the process.

Step 8:
If we divide 300 by 40, we get 7 and a remainder of 20.
The next digit of our result is 7. 
Result so far: 14849.27
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:
If we divide 200 by 40, we get 5 and a remainder of 0.
Record the quotient 5 as the next digit in the result. 
Result so far: 14849.275
Subtracting 200 from 200 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.

Going ahead to step 10:
When dividing 0 by 40, we get 0 with a remainder of 0.
Write down 0 as next digit of the result. 
Result so far: 14849.275
Deduct 0 from 0 and we're left 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:
The number 40 fits into 0 0 times, leaving a remainder of 0.
Write down 0 as next digit of the result. 
Result so far: 14849.275
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.

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