Removing Cubes (noch nicht übersetzt)

Problem 884

Starting from a positive integer n, at each step we subtract from n the largest perfect cube not exceeding n, until n becomes 0.
For example, with n=100 the procedure ends in 4 steps: 1004336339231130.

Let D(n) denote the number of steps of the procedure. Thus D(100)=4.

Let S(N) denote the sum of D(n) for all positive integers n strictly less than N.
For example, S(100)=512.

Find S(1017).