511787 ÷ 40 
We want to figure out the number of times 511787 can be divided by 40.

Let's proceed to step 1:
The number 40 fits into 5 0 times, leaving a remainder of 5.
Record the quotient 0 as the next digit in the result. 
Result so far: 0.0
Subtract 0 from 5 to get 5.
Grab the next digit (1) from the dividend, add it to 5, then carry on: 51 / 40

Going ahead to step 2:
The number 40 fits into 51 1 times, leaving a remainder of 11.
The next digit of our result is 1. 
Result so far: 1.0
If we take 40 away from 51, we end up with 11.
Include the next digit (1) from the dividend after 11, then repeat: 111 / 40

Going ahead to step 3:
40 goes into 111 2 times with a remainder of 31.
Use 2 as the next digit of our solution. 
Result so far: 12.0
Deduct 80 from 111 and we're left with 31.
Take the next digit (7) from the dividend and append it to 31, then repeat: 317 / 40

Let's proceed to step 4:
When dividing 317 by 40, we get 7 with a remainder of 37.
Record the quotient 7 as the next digit in the result. 
Result so far: 127.0
Subtracting 280 from 317 leaves us with 37.
Append the next digit (8) from the dividend to 37 and continue with: 378 / 40

Advancing to step 5:
40 goes into 378 9 times with a remainder of 18.
Use 9 as the next digit of our solution. 
Result so far: 1279.0
If we take 360 away from 378, we end up with 18.
Take the next digit (7) from the dividend and append it to 18, then repeat: 187 / 40

Advancing to step 6:
40 can be fit into 187 4 times, resulting in a remainder of 27.
Put 4 as the next digit of the answer. 
Result so far: 12794.0
Deduct 160 from 187 and we're left with 27.
Since there are no more digits in the dividend, we add a zero to the remainder making it 270, and continue the process.

Advancing to step 7:
270 divided by 40 is 6 with a remainder of 30.
The next digit of our result is 6. 
Result so far: 12794.6
Deduct 240 from 270 and we're left with 30.
Since there are no more digits in the dividend, we add a zero to the remainder making it 300, and continue the process.

Advancing to step 8:
The number 40 fits into 300 7 times, leaving a remainder of 20.
Put 7 as the next digit of the answer. 
Result so far: 12794.67
Subtracting 280 from 300 leaves us with 20.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

Step 9:
40 goes into 200 5 times with a remainder of 0.
The number 5 becomes the next digit in our result. 
Result so far: 12794.675
The remainder is 0 after subtracting 200 from 200.
Since there are no more digits in the dividend, we add a zero to the remainder making it 0, and continue the process.

Let's proceed to step 10:
40 can be fit into 0 0 times, resulting in a remainder of 0.
Record the quotient 0 as the next digit in the result. 
Result so far: 12794.675
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.

On to step 11:
40 goes into 0 0 times with a remainder of 0.
Use 0 as the next digit of our solution. 
Result so far: 12794.675
Subtracting 0 from 0 leaves us 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.

After the division, we end up with 12794.675 and a remainder of 0.0.