[tex]3^{2x}+3\cdot9^x+3^{2x+3}=2511\\
3^{2x}+3\cdot3^{2x}++3^3\cdot3^{2x}=2511\\
3^{2x}(1+3+3^3)=2511\\
31\cdot3^{2x}=2511\\
3^{2x}=\frac{2511}{31}=81=3^4\\
2x=4\Rightarrow \boxed{x=2}\\
\\
2^{x+3}+2^{x+2}+2^{x+1}+2^x=240\\
2^3\cdot2^x+2^2\cdot2^x+2\cdot2^x+2^x=240\\
2^x(8+4+2+1)=240\\
2^x\cdot15=240\\
2^x=\frac{240}{15}=16=2^4\\
\Rightarrow\boxed{x=4}[/tex]