We're dividing 513178 by 40 
We're looking to find how many times 40 goes into 513178.

Step 1:
The number 40 fits into 5 0 times, leaving a remainder of 5.
Write down 0 as next digit of the result. 
Result so far: 0.0
If we take 0 away from 5, we end up with 5.
Append the next digit (1) from the dividend to 5 and continue with: 51 / 40

Advancing to step 2:
40 can be fit into 51 1 times, resulting in a remainder of 11.
Write down 1 as next digit of the result. 
Result so far: 1.0
Subtracting 40 from 51 leaves us with 11.
Take the next digit (3) from the dividend and append it to 11, then repeat: 113 / 40

On to step 3:
The number 40 fits into 113 2 times, leaving a remainder of 33.
Write down 2 as next digit of the result. 
Result so far: 12.0
Subtract 80 from 113 to get 33.
Take the next digit (1) from the dividend and append it to 33, then repeat: 331 / 40

Advancing to step 4:
40 can be fit into 331 8 times, resulting in a remainder of 11.
Record the quotient 8 as the next digit in the result. 
Result so far: 128.0
Subtracting 320 from 331 leaves us with 11.
Bring next digit (7) of the dividend behind the 11 and repeat the process: 117 / 40

Going ahead to step 5:
The number 40 fits into 117 2 times, leaving a remainder of 37.
Use 2 as the next digit of our solution. 
Result so far: 1282.0
Subtract 80 from 117 to get 37.
Fetch the next digit (8) from the dividend, attach it to 37 and continue: 378 / 40

Step 6:
378 divided by 40 is 9 with a remainder of 18.
Write down 9 as next digit of the result. 
Result so far: 12829.0
If we take 360 away from 378, we end up with 18.
Since there are no more digits in the dividend, we add a zero to the remainder making it 180, and continue the process.

Advancing to step 7:
If we divide 180 by 40, we get 4 and a remainder of 20.
Record the quotient 4 as the next digit in the result. 
Result so far: 12829.4
If we subtract 160 from 180, 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 8:
200 divided by 40 is 5 with a remainder of 0.
Use 5 as the next digit of our solution. 
Result so far: 12829.45
Subtract 200 from 200 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.

Let's proceed to step 9:
The number 40 fits into 0 0 times, leaving a remainder of 0.
The number 0 becomes the next digit in our result. 
Result so far: 12829.45
If we take 0 away from 0, we end up 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.

Moving on to step 10:
40 goes into 0 0 times with a remainder of 0.
The number 0 becomes the next digit in our result. 
Result so far: 12829.45
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.

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