O(\log^2{n}). That’s because \lfloor\frac{\lfloor n/a \rfloor}{b}\rfloor = \lfloor \frac{n}{ab}\rfloor. If you don’t understand why the fact above proves it, you can ask me.
I proved in following way , correct me if i am wrong .
for number below or equal to 1 , we need to do constant number of operations. ceil(n/2^x) >= 1 hence x = O(logn) , similarly for 3.
Also ceil(n/(2^x*3^y) )>= 1 , thus logn >= x + ylog3 , total possible combination (x,y) for this equation is O(log^2n) . Since 4 = 2^2 we , don’t need to take care of it while calculation total possible numbers we will reach in recursion .Since we are using map , hence overall complexity is O(log^2n * log(log^2n)) .
Oops, I forgot about the map.
Our actual complexity is O(\log^2{n}\log{(\log^2{n})})
That’s negligible anyways.
The actual proof is that there will be O(\log{n}) values of the form \lfloor n/2^k\rfloor, O(log(n/3)) values of the type \lfloor n/(3^1 * 2^k)\rfloor and so on. The sum is O(\log^2{n})
As you can see, It levels out at a constant.
Comaparing my function to the answer for 10^i from i=0 to 120.
The last column is the ratio of the actual answer to my bound. It fluctuates at the start, and then slowly goes upto 97\%. I think O(\log^2{n}) is correct number of points, but The time complexity will become worse because dividing big numbers also takes more time.
Graph tells that it’s tight bound.Do you know some mathematical way to prove that sum is Θ(log^2n) ? It is O(log^2n) , we need to proof it’s Ω(log^2n).