
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 the arithmetic sequence $\{a_n\}$, $a_2=2$, and in the sequence $\{b_n\}$, $b_n=2^{a_n}$, $b_4=4b_2$, where $n\in\mathbb{N}^*$. 

    (1) Find the general formula for the sequences $\{a_n\}$ and $\{b_n\}$.

    (2) If $a_2b_1-a_1b_1+a_3b_2-a_2b_2+\ldots+a_{n+1}b_n-a_nb_n \leqslant 2017$, find the maximum value of $n$.

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