We're dividing 504165 by 27 
The aim is to understand the frequency of 27 in 504165.

Step 1:
If we divide 5 by 27, we get 0 and a remainder of 5.
Write down 0 as next digit of the result. 
Result so far: 0.0
Subtract 0 from 5 to get 5.
Append the next digit (0) from the dividend to 5 and continue with: 50 / 27

Moving on to step 2:
The number 27 fits into 50 1 times, leaving a remainder of 23.
The number 1 becomes the next digit in our result. 
Result so far: 1.0
Deduct 27 from 50 and we're left with 23.
Take the next digit (4) from the dividend and append it to 23, then repeat: 234 / 27

Let's proceed to step 3:
The number 27 fits into 234 8 times, leaving a remainder of 18.
The number 8 becomes the next digit in our result. 
Result so far: 18.0
Subtracting 216 from 234 leaves us with 18.
Take the next digit (1) from the dividend and append it to 18, then repeat: 181 / 27

Step 4:
The number 27 fits into 181 6 times, leaving a remainder of 19.
Write down 6 as next digit of the result. 
Result so far: 186.0
If we take 162 away from 181, we end up with 19.
Take the next digit (6) from the dividend and append it to 19, then repeat: 196 / 27

Advancing to step 5:
If we divide 196 by 27, we get 7 and a remainder of 7.
The next digit of our result is 7. 
Result so far: 1867.0
Subtract 189 from 196 to get 7.
Append the next digit (5) from the dividend to 7 and continue with: 75 / 27

Step 6:
27 can be fit into 75 2 times, resulting in a remainder of 21.
Put 2 as the next digit of the answer. 
Result so far: 18672.0
Deduct 54 from 75 and we're left with 21.
Since there are no more digits in the dividend, we add a zero to the remainder making it 210, and continue the process.

Moving on to step 7:
27 goes into 210 7 times with a remainder of 21.
Use 7 as the next digit of our solution. 
Result so far: 18672.7
Subtract 189 from 210 to get 21.
Since there are no more digits in the dividend, we add a zero to the remainder making it 210, and continue the process.

Advancing to step 8:
27 can be fit into 210 7 times, resulting in a remainder of 21.
Put 7 as the next digit of the answer. 
Result so far: 18672.77
Subtracting 189 from 210 leaves us with 21.
Since there are no more digits in the dividend, we add a zero to the remainder making it 210, and continue the process.

The final result is 18672.77 with a remainder of 0.021.