15 lines
145 B
Go
15 lines
145 B
Go
|
package main
|
||
|
|
||
|
func minSteps(n int) int {
|
||
|
steps := 0
|
||
|
|
||
|
for d := 2; n > 1; d++ {
|
||
|
for n%d == 0 {
|
||
|
steps += d
|
||
|
n /= d
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return steps
|
||
|
}
|