Update 370

I'm specifically having trouble writing my loop in such a way that it terminates and yields the correct number, any advice would be appreciated.