Lets take simple case when n=9, you will have a recursion tree as follows-
9
3 3 3
1 1 1 1 1 1 1 1 1
This is nothing but perfect 3-ary tree.
At each node, you have a printf statement. So we need to count no of nodes in such tree.
No. of levels(x) for given n in such tree will be ceil(log3n).
Total no of nodes in perfect 3-ary tree = (3x-1)/2 = (3ceil(log3n)-1)/2
In this question n=3k, So total no of printf statements(total no of nodes in recursion tree)=(3ceil(log33k)-1)/2