Let $n\geqslant 2$ be an integer, and let $A_n$ be the set
$$A_n=\{2^n-2^k\mid k\in\mathbb{Z},0\leqslant k<n\}.$$ Determine the largest positive integer that cannot be written as the sum of one or more (not necessarily distinct) elements of $A_n.$ Please provide the value when n = 9.

Let's think step by step and output the final answer within \boxed{}.
user