We look at the division of 31166328 by 506 
The aim is to understand the frequency of 506 in 31166328.

On to step 1:
If we divide 3 by 506, we get 0 and a remainder of 3.
The number 0 becomes the next digit in our result. 
Result so far: 0.0
Deduct 0 from 3 and we're left with 3.
Bring next digit (1) of the dividend behind the 3 and repeat the process: 31 / 506

Step 2:
31 divided by 506 is 0 with a remainder of 31.
Write down 0 as next digit of the result. 
Result so far: 0.0
Deduct 0 from 31 and we're left with 31.
Grab the next digit (1) from the dividend, add it to 31, then carry on: 311 / 506

Advancing to step 3:
506 goes into 311 0 times with a remainder of 311.
Record the quotient 0 as the next digit in the result. 
Result so far: 0.0
Subtracting 0 from 311 leaves us with 311.
Fetch the next digit (6) from the dividend, attach it to 311 and continue: 3116 / 506

On to step 4:
3116 divided by 506 is 6 with a remainder of 80.
The number 6 becomes the next digit in our result. 
Result so far: 6.0
If we take 3036 away from 3116, we end up with 80.
Take the next digit (6) from the dividend and append it to 80, then repeat: 806 / 506

Going ahead to step 5:
If we divide 806 by 506, we get 1 and a remainder of 300.
Write down 1 as next digit of the result. 
Result so far: 61.0
Subtracting 506 from 806 leaves us with 300.
Take the next digit (3) from the dividend and append it to 300, then repeat: 3003 / 506

Going ahead to step 6:
506 goes into 3003 5 times with a remainder of 473.
The number 5 becomes the next digit in our result. 
Result so far: 615.0
If we take 2530 away from 3003, we end up with 473.
Grab the next digit (2) from the dividend, add it to 473, then carry on: 4732 / 506

Step 7:
The number 506 fits into 4732 9 times, leaving a remainder of 178.
Record the quotient 9 as the next digit in the result. 
Result so far: 6159.0
Subtract 4554 from 4732 to get 178.
Fetch the next digit (8) from the dividend, attach it to 178 and continue: 1788 / 506

Going ahead to step 8:
1788 divided by 506 is 3 with a remainder of 270.
The number 3 becomes the next digit in our result. 
Result so far: 61593.0
Subtracting 1518 from 1788 leaves us with 270.
Since there are no more digits in the dividend, we add a zero to the remainder making it 2700, and continue the process.

Advancing to step 9:
When dividing 2700 by 506, we get 5 with a remainder of 170.
Put 5 as the next digit of the answer. 
Result so far: 61593.5
If we take 2530 away from 2700, we end up with 170.
Since there are no more digits in the dividend, we add a zero to the remainder making it 1700, and continue the process.

Moving on to step 10:
The number 506 fits into 1700 3 times, leaving a remainder of 182.
The next digit of our result is 3. 
Result so far: 61593.53
If we take 1518 away from 1700, we end up with 182.
Since there are no more digits in the dividend, we add a zero to the remainder making it 1820, and continue the process.

On to step 11:
506 goes into 1820 3 times with a remainder of 302.
Put 3 as the next digit of the answer. 
Result so far: 61593.533
Deduct 1518 from 1820 and we're left with 302.
Since there are no more digits in the dividend, we add a zero to the remainder making it 3020, and continue the process.

After the division, we end up with 61593.533 and a remainder of 0.0302.