The program required is written above. It uses only two variables k and total as mentioned in the question. And the total is initially set to 9, and then its value is incremented by the square of each k during each loop established by while loop. And finally, when k=1, the output is returned. And we have printed the return value using print.
I have a kindle paper white that I downloaded all of my avalible textbook onto if that helps I find it much better then carrying around a bunch of textbooks