
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
Sequences  $a_n$  and  $b_n$  are defined for all positive integers  $n$  such that  $a_1 = 5,$   $b_1 = 7,$    $$ a_{n+1} = \frac{\sqrt{(a_n+b_n-1)^2+(a_n-b_n+1)^2}}{2}, $$  and   $$ b_{n+1} = \frac{\sqrt{(a_n+b_n+1)^2+(a_n-b_n-1)^2}}{2}. $$   $ $  
How many integers  $n$  from 1 to 1000 satisfy the property that  $a_n, b_n$  form the legs of a right triangle with a hypotenuse that has integer length?

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