k+floor[(n-k^2)/k]