
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Given that $\{a_n\}$ is a geometric sequence with all positive terms, $\frac{1}{2}a_3$ is the arithmetic mean of $3a_1$ and $2a_2$, and $a_1a_2=a_3$.

$(1)$ Find the general formula for the sequence $\{a_n\}$;

$(2)$ Let $b_n=\log_3a_n$, and let $S_n$ be the sum of the first $n$ terms of the sequence $\{b_n\}$. Find the sum of the first $n$ terms, $T_n$, of the sequence $\left\{ \frac{1+2S_n}{S_n} \right\}$.

Present the answer in LaTex format: \boxed{Your answer}
user