Lets try to get the formula by forming the recurrence relation.
Let T(n) denote the number of leaves of a 3 ary tree having ‘n’ internal nodes.
Base case : T(1) = 3
Now if we take one of the leaf nodes and convert it to internal node by adding 3 children to it, then no of leaves would decrease by 1 (since one leaf got converted to internal node) and also increase by 3(owing to the 3 new leaves created by leaf which converted to internal node)
So now T(n)=T(n-1)+3-1
=T(n-1)+2
=T(n-2)+2*2
=T(n-3)+3*2
……
=T(n-k)+k*2
when n-k=1, k=n-1, also T(n-k)=T(1)=3
=3+2*(n-1)
=2n+1