We look at the division of 512771 by 18 
The aim is to understand the frequency of 18 in 512771.

Moving on to step 1:
When dividing 5 by 18, we get 0 with a remainder of 5.
Use 0 as the next digit of our solution. 
Result so far: 0.0
The remainder is 5 after subtracting 0 from 5.
Fetch the next digit (1) from the dividend, attach it to 5 and continue: 51 / 18

Moving on to step 2:
If we divide 51 by 18, we get 2 and a remainder of 15.
Write down 2 as next digit of the result. 
Result so far: 2.0
Deduct 36 from 51 and we're left with 15.
Append the next digit (2) from the dividend to 15 and continue with: 152 / 18

Moving on to step 3:
18 can be fit into 152 8 times, resulting in a remainder of 8.
Write down 8 as next digit of the result. 
Result so far: 28.0
Deduct 144 from 152 and we're left with 8.
Take the next digit (7) from the dividend and append it to 8, then repeat: 87 / 18

Step 4:
When dividing 87 by 18, we get 4 with a remainder of 15.
The number 4 becomes the next digit in our result. 
Result so far: 284.0
If we take 72 away from 87, we end up with 15.
Bring next digit (7) of the dividend behind the 15 and repeat the process: 157 / 18

Moving on to step 5:
When dividing 157 by 18, we get 8 with a remainder of 13.
Use 8 as the next digit of our solution. 
Result so far: 2848.0
The remainder is 13 after subtracting 144 from 157.
Take the next digit (1) from the dividend and append it to 13, then repeat: 131 / 18

Step 6:
131 divided by 18 is 7 with a remainder of 5.
Put 7 as the next digit of the answer. 
Result so far: 28487.0
Subtract 126 from 131 to get 5.
Since there are no more digits in the dividend, we add a zero to the remainder making it 50, and continue the process.

Step 7:
50 divided by 18 is 2 with a remainder of 14.
Record the quotient 2 as the next digit in the result. 
Result so far: 28487.2
Deduct 36 from 50 and we're left with 14.
Since there are no more digits in the dividend, we add a zero to the remainder making it 140, and continue the process.

Moving on to step 8:
18 can be fit into 140 7 times, resulting in a remainder of 14.
The next digit of our result is 7. 
Result so far: 28487.27
Subtract 126 from 140 to get 14.
Since there are no more digits in the dividend, we add a zero to the remainder making it 140, and continue the process.

Going ahead to step 9:
18 can be fit into 140 7 times, resulting in a remainder of 14.
Record the quotient 7 as the next digit in the result. 
Result so far: 28487.277
Subtracting 126 from 140 leaves us with 14.
Since there are no more digits in the dividend, we add a zero to the remainder making it 140, and continue the process.

After the division, we end up with 28487.277 and a remainder of 0.0014.