
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 a sequence $\{a_n\}$ with the sum of the first $n$ terms denoted as $S_n$, $a_1 \neq 0$, a constant $\lambda > 0$, and $\lambda a_1 a_n = S_1 + S_n$ holds for all positive integers $n$.  
$(1)$ Find the general formula for the sequence $\{a_n\}$.  
$(2)$ Suppose $a_1 > 0$ and $\lambda = 100$, for what value of $n$ is the sum of the first $n$ terms of the sequence $\{\lg \frac{1}{a_n}\}$ maximized?

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