2. Sergey wrote down the numbers from 500 to 1499 in a row in some order. Under each number, except the leftmost one, he wrote the GCD of that number and its left neighbor, obtaining a second row of 999 numbers. Then he applied the same rule to get a third row of 998 numbers, from it a fourth row of 997 numbers, and so on. He stopped when all the numbers in the next row were equal to one for the first time. What is the maximum number of rows he could have written by this moment?
Answer: 501 (in the second variant 10001).

Let's prove that all numbers in the 501st row are already equal to 1. Indeed, if there is a number $d \neq 1$ in it, then in the 500th row there are 2 numbers divisible by $d$, in the 449th row - 3 such numbers, ..., in the 1st row there are 501 such numbers. But no number $d$ has so many multiples among 1000 consecutive numbers!

Thus, Sergei could not write more than 501 rows. If he arranges the first row with 500 even numbers followed by 500 odd numbers, then in the 500th row an even number will remain, so he will stop only after the 501st row.