I didn't seem straightforward to me, and I guess a bit explanation would be helpful for following readers like me: calculating T(n/3) is an one-time work just for n1, meaning the following n2 or sum do not call T(n) again - they use n1. :) And the nested-loop takes Theta(n^2) time. That's how we get T(n)=T(n/3)+n^2.