Đặt P=31-1+32-1+33-1+34-1+...+3n-1
=>P=30+31+32+33+...+3n-1
=>3.P=31+32+33+34+...+3n
=>3.P-P=31+32+33+34+...+3n-30-31-32-33-...-3n-1
=>2.P=3n-30
=>2.P=3n-1
=>\(P=\frac{3^n-1}{2}\)
Lại có: S=1+2+5+14+...+\(\frac{3^{n-1}+1}{2}\)
=>\(S=\frac{3^{1-1}+1}{2}+\frac{3^{2-1}+1}{2}+\frac{3^{3-1}+1}{2}+\frac{3^{4-1}+1}{2}+...+\frac{3^{n-1}+1}{2}\)
=>\(S=\frac{3^{1-1}+1+3^{2-1}+1+3^{3-1}+1+3^{4-1}+1+...+3^{n-1}+1}{2}\)
=>\(S=\frac{\left(3^{1-1}+3^{2-1}+3^{3-1}+3^{4-1}+...+3^{n-1}\right)+\left(1+1+1+1+...+1\right)}{2}\)
=>\(S=\frac{P+1.n}{2}\)
=>\(S=\frac{\frac{3^n-1}{2}+n}{2}\)
=>\(S=\frac{\frac{3^n-1}{2}+\frac{2n}{2}}{2}\)
=>\(S=\frac{\frac{3^n-1+2n}{2}}{2}\)
=>\(S=\frac{3^n-1+2n}{4}\)