[Tex/LaTex] How to calculate geometric sequence in LaTeX

calculations

I am trying to make my own command to calculate geometric sequence in LaTeX example: 10*4^(n+1)
I've tried couple of things similar to this but non of them seemed to work:

\newcommand{\GeometricSequence} [1] {\the\numexpr 10*4^(#1+1) \relax \\}

So if type command (shown below) it should "print" 3360.

\GeometricSequence {3}

Best Answer

Up to 24 because of floating point precision limitation.

enter image description here

\documentclass{article}

\usepackage{tikz,xfp}

\newcommand{\GeometricSequence}[1]{%
\def\Tot{0}%
\def\Som{%
$g(#1)=\foreach \n in {1,...,#1}
    {\xdef\Tot{\Tot+\fpeval{10*4^(\n+1)}}%
     \ifnum\n>1+\fi
     10\times4^{\fpeval{\n+1}}}=\fpeval{\Tot}$}%
    \Som
}

\pagestyle{empty}
\begin{document}

\GeometricSequence{12}

\end{document}