
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
For every integer \( n \geq 2 \), let \( f(n) \) denote the number of distinct solutions of \( \sin(nx) = \sin(x) \) in the interval \( [0, \pi] \), and \( g(n) \) denote the number of distinct solutions of \( \cos(nx) = \cos(x) \) in the interval \( [0, \pi] \). Then, calculate the sum \( \sum_{n=2}^{2017}(g(n)-f(n)) \).

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