We're dividing 509317 by 4 
The aim is to understand the frequency of 4 in 509317.

Going ahead to step 1:
If we divide 5 by 4, we get 1 and a remainder of 1.
Put 1 as the next digit of the answer. 
Result so far: 1.0
Subtract 4 from 5 to get 1.
Bring next digit (0) of the dividend behind the 1 and repeat the process: 10 / 4

Step 2:
The number 4 fits into 10 2 times, leaving a remainder of 2.
Record the quotient 2 as the next digit in the result. 
Result so far: 12.0
If we take 8 away from 10, we end up with 2.
Include the next digit (9) from the dividend after 2, then repeat: 29 / 4

On to step 3:
When dividing 29 by 4, we get 7 with a remainder of 1.
The next digit of our result is 7. 
Result so far: 127.0
If we subtract 28 from 29, we get 1.
Append the next digit (3) from the dividend to 1 and continue with: 13 / 4

Going ahead to step 4:
4 can be fit into 13 3 times, resulting in a remainder of 1.
Write down 3 as next digit of the result. 
Result so far: 1273.0
Deduct 12 from 13 and we're left with 1.
Append the next digit (1) from the dividend to 1 and continue with: 11 / 4

Step 5:
If we divide 11 by 4, we get 2 and a remainder of 3.
The next digit of our result is 2. 
Result so far: 12732.0
Subtract 8 from 11 to get 3.
Grab the next digit (7) from the dividend, add it to 3, then carry on: 37 / 4

Moving on to step 6:
When dividing 37 by 4, we get 9 with a remainder of 1.
The number 9 becomes the next digit in our result. 
Result so far: 127329.0
Deduct 36 from 37 and we're left with 1.
Since there are no more digits in the dividend, we add a zero to the remainder making it 10, and continue the process.

Step 7:
10 divided by 4 is 2 with a remainder of 2.
Use 2 as the next digit of our solution. 
Result so far: 127329.2
Subtracting 8 from 10 leaves us with 2.
Since there are no more digits in the dividend, we add a zero to the remainder making it 20, and continue the process.

Step 8:
20 divided by 4 is 5 with a remainder of 0.
Write down 5 as next digit of the result. 
Result so far: 127329.25
If we take 20 away from 20, 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.

Advancing to step 9:
4 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: 127329.25
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.

Step 10:
When dividing 0 by 4, we get 0 with a remainder of 0.
The number 0 becomes the next digit in our result. 
Result so far: 127329.25
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.

In conclusion, the division gives 127329.25 with a balance of 0.0.