Cut a spring into n pieces (n smaller springs, so spring constant is n*k), each spring with the same mass m. Each spring need to hold the hanging mass and all the springs under itself. So each spring extend different length (linearly). Calculate all the above and use a effective spring to replace it. Then, you will find the answer you want.