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

Advancing to step 1:
When dividing 6 by 40, we get 0 with a remainder of 6.
Put 0 as the next digit of the answer. 
Result so far: 0.0
Subtract 0 from 6 to get 6.
Bring next digit (4) of the dividend behind the 6 and repeat the process: 64 / 40

Going ahead to step 2:
When dividing 64 by 40, we get 1 with a remainder of 24.
Record the quotient 1 as the next digit in the result. 
Result so far: 1.0
The remainder is 24 after subtracting 40 from 64.
Grab the next digit (0) from the dividend, add it to 24, then carry on: 240 / 40

On to step 3:
240 divided by 40 is 6 with a remainder of 0.
Put 6 as the next digit of the answer. 
Result so far: 16.0
If we subtract 240 from 240, we get 0.
Grab the next digit (8) from the dividend, add it to 0, then carry on: 8 / 40

Moving on to step 4:
40 goes into 8 0 times with a remainder of 8.
Use 0 as the next digit of our solution. 
Result so far: 160.0
Subtract 0 from 8 to get 8.
Bring next digit (7) of the dividend behind the 8 and repeat the process: 87 / 40

Let's proceed to step 5:
If we divide 87 by 40, we get 2 and a remainder of 7.
The number 2 becomes the next digit in our result. 
Result so far: 1602.0
Deduct 80 from 87 and we're left with 7.
Include the next digit (1) from the dividend after 7, then repeat: 71 / 40

Moving on to step 6:
When dividing 71 by 40, we get 1 with a remainder of 31.
Write down 1 as next digit of the result. 
Result so far: 16021.0
If we take 40 away from 71, we end up with 31.
Since there are no more digits in the dividend, we add a zero to the remainder making it 310, and continue the process.

On to step 7:
40 goes into 310 7 times with a remainder of 30.
Put 7 as the next digit of the answer. 
Result so far: 16021.7
Subtract 280 from 310 to get 30.
Since there are no more digits in the dividend, we add a zero to the remainder making it 300, and continue the process.

Moving on to step 8:
If we divide 300 by 40, we get 7 and a remainder of 20.
The number 7 becomes the next digit in our result. 
Result so far: 16021.77
The remainder is 20 after subtracting 280 from 300.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

In conclusion, the division gives 16021.77 with a balance of 0.02.