501581 divided by 40 
We want to divide 501581 by 40.

Step 1:
The number 40 fits into 5 0 times, leaving a remainder of 5.
Put 0 as the next digit of the answer. 
Result so far: 0.0
Subtract 0 from 5 to get 5.
Fetch the next digit (0) from the dividend, attach it to 5 and continue: 50 / 40

On to step 2:
40 can be fit into 50 1 times, resulting in a remainder of 10.
The number 1 becomes the next digit in our result. 
Result so far: 1.0
If we subtract 40 from 50, we get 10.
Fetch the next digit (1) from the dividend, attach it to 10 and continue: 101 / 40

On to step 3:
40 goes into 101 2 times with a remainder of 21.
Put 2 as the next digit of the answer. 
Result so far: 12.0
The remainder is 21 after subtracting 80 from 101.
Fetch the next digit (5) from the dividend, attach it to 21 and continue: 215 / 40

On to step 4:
The number 40 fits into 215 5 times, leaving a remainder of 15.
Put 5 as the next digit of the answer. 
Result so far: 125.0
Subtract 200 from 215 to get 15.
Take the next digit (8) from the dividend and append it to 15, then repeat: 158 / 40

Moving on to step 5:
158 divided by 40 is 3 with a remainder of 38.
Use 3 as the next digit of our solution. 
Result so far: 1253.0
If we subtract 120 from 158, we get 38.
Bring next digit (1) of the dividend behind the 38 and repeat the process: 381 / 40

Let's proceed to step 6:
40 can be fit into 381 9 times, resulting in a remainder of 21.
Record the quotient 9 as the next digit in the result. 
Result so far: 12539.0
Deduct 360 from 381 and we're left with 21.
Since there are no more digits in the dividend, we add a zero to the remainder making it 210, and continue the process.

Let's proceed to step 7:
40 goes into 210 5 times with a remainder of 10.
Use 5 as the next digit of our solution. 
Result so far: 12539.5
If we subtract 200 from 210, we get 10.
Since there are no more digits in the dividend, we add a zero to the remainder making it 100, and continue the process.

Step 8:
If we divide 100 by 40, we get 2 and a remainder of 20.
Write down 2 as next digit of the result. 
Result so far: 12539.52
If we subtract 80 from 100, we get 20.
Since there are no more digits in the dividend, we add a zero to the remainder making it 200, and continue the process.

Moving on to step 9:
200 divided by 40 is 5 with a remainder of 0.
Record the quotient 5 as the next digit in the result. 
Result so far: 12539.525
Deduct 200 from 200 and we're left 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.

Going ahead to step 10:
When dividing 0 by 40, we get 0 with a remainder of 0.
Use 0 as the next digit of our solution. 
Result so far: 12539.525
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.

Advancing to step 11:
The number 40 fits into 0 0 times, leaving a remainder of 0.
Record the quotient 0 as the next digit in the result. 
Result so far: 12539.525
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.

The quotient of the division is 12539.525, and the remainder is 0.0.