We divide 31501797 by 2
The aim is to understand the frequency of 2 in 31501797.

Let's proceed to step 1:
2 goes into 3 1 times with a remainder of 1.
Use 1 as the next digit of our solution. 
Result so far: 1.0
If we take 2 away from 3, we end up with 1.
Bring next digit (1) of the dividend behind the 1 and repeat the process: 11 / 2

Step 2:
The number 2 fits into 11 5 times, leaving a remainder of 1.
Record the quotient 5 as the next digit in the result. 
Result so far: 15.0
Deduct 10 from 11 and we're left with 1.
Take the next digit (5) from the dividend and append it to 1, then repeat: 15 / 2

On to step 3:
2 goes into 15 7 times with a remainder of 1.
The next digit of our result is 7. 
Result so far: 157.0
Subtract 14 from 15 to get 1.
Take the next digit (0) from the dividend and append it to 1, then repeat: 10 / 2

On to step 4:
10 divided by 2 is 5 with a remainder of 0.
Put 5 as the next digit of the answer. 
Result so far: 1575.0
Subtract 10 from 10 to get 0.
Grab the next digit (1) from the dividend, add it to 0, then carry on: 1 / 2

Going ahead to step 5:
If we divide 1 by 2, we get 0 and a remainder of 1.
The next digit of our result is 0. 
Result so far: 15750.0
Deduct 0 from 1 and we're left with 1.
Take the next digit (7) from the dividend and append it to 1, then repeat: 17 / 2

Step 6:
2 goes into 17 8 times with a remainder of 1.
The next digit of our result is 8. 
Result so far: 157508.0
Subtract 16 from 17 to get 1.
Take the next digit (9) from the dividend and append it to 1, then repeat: 19 / 2

Going ahead to step 7:
If we divide 19 by 2, we get 9 and a remainder of 1.
The number 9 becomes the next digit in our result. 
Result so far: 1575089.0
Subtracting 18 from 19 leaves us with 1.
Take the next digit (7) from the dividend and append it to 1, then repeat: 17 / 2

Going ahead to step 8:
If we divide 17 by 2, we get 8 and a remainder of 1.
Record the quotient 8 as the next digit in the result. 
Result so far: 15750898.0
If we take 16 away from 17, we end up 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.

On to step 9:
10 divided by 2 is 5 with a remainder of 0.
Use 5 as the next digit of our solution. 
Result so far: 15750898.5
Subtract 10 from 10 to 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 10:
2 goes into 0 0 times with a remainder of 0.
The number 0 becomes the next digit in our result. 
Result so far: 15750898.5
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.

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

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