
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
In an arithmetic sequence $\{a_n\}$ with a non-zero common difference, it is known that $a_1=4$ and $a_7^2=a_1a_{10}$. The sum of the first $n$ terms is $S_n$.
1. Find the general formula for the sequence $\{a_n\}$.
2. Find the maximum value of $S_n$ and the value of $n$ when the maximum is achieved.

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