Let's divide 509340 by 4
The aim is to understand the frequency of 4 in 509340.

Going ahead to step 1:
When dividing 5 by 4, we get 1 with a remainder of 1.
The next digit of our result is 1. 
Result so far: 1.0
If we subtract 4 from 5, we get 1.
Append the next digit (0) from the dividend to 1 and continue with: 10 / 4

Going ahead to step 2:
When dividing 10 by 4, we get 2 with a remainder of 2.
Write down 2 as next digit of the result. 
Result so far: 12.0
If we subtract 8 from 10, we get 2.
Append the next digit (9) from the dividend to 2 and continue with: 29 / 4

Going ahead to step 3:
The number 4 fits into 29 7 times, leaving a remainder of 1.
The number 7 becomes the next digit in our result. 
Result so far: 127.0
If we take 28 away from 29, we end up with 1.
Take the next digit (3) from the dividend and append it to 1, then repeat: 13 / 4

Going ahead to step 4:
If we divide 13 by 4, we get 3 and a remainder of 1.
Record the quotient 3 as the next digit in the result. 
Result so far: 1273.0
If we take 12 away from 13, we end up with 1.
Grab the next digit (4) from the dividend, add it to 1, then carry on: 14 / 4

Going ahead to step 5:
When dividing 14 by 4, we get 3 with a remainder of 2.
Use 3 as the next digit of our solution. 
Result so far: 12733.0
Subtract 12 from 14 to get 2.
Fetch the next digit (0) from the dividend, attach it to 2 and continue: 20 / 4

Going ahead to step 6:
20 divided by 4 is 5 with a remainder of 0.
Write down 5 as next digit of the result. 
Result so far: 127335.0
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.

Step 7:
If we divide 0 by 4, we get 0 and a remainder of 0.
The next digit of our result is 0. 
Result so far: 127335.0
If we subtract 0 from 0, we 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.

Going ahead to step 8:
4 goes into 0 0 times with a remainder of 0.
The number 0 becomes the next digit in our result. 
Result so far: 127335.0
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.

Our division results in 127335.0 with a remaining 0.0.