We look for a divisor `d`

so that we can make `d`

copies of `(n / d)`

to get `n`

The process of making `d`

copies takes `d`

steps (`1`

step of **Copy All** and `d - 1`

steps of **Paste**)

We keep reducing the problem to a smaller one in a loop.

The **best** cases occur when `n`

is decreasing fast, and method is almost `O(log(n))`

For example, when `n = 1024`

then `n`

will be divided by `2`

for only `10`

iterations, which is much faster than `O(n)`

DP method.

The **worst** cases occur when `n`

is some multiple of large prime, e.g. `n = 997`

but such cases are rare.

```
public int minSteps(int n) {
int s = 0;
for (int d = 2; d <= n; d++) {
while (n % d == 0) {
s += d;
n /= d;
}
}
return s;
}
```