**2013 AIME I 15.** Let be the number of ordered triples of integers satisfying the conditions

(a) ,

(b) there exist integers , , and , and prime where ,

(c) divides , , and , and

(d) each ordered triple and each ordered triple form arithmetic sequences.

Find .

* There are many variables in this problem, with some of them ordered in a non-traditional way (see (b)).* Let’s try to lay them out in a way that makes sense:

Here, we’ve put (a) and (b) in a diagram. * The next bit of information we’ll put into the diagram is (d).* Since we are working with triplets forming arithmetic sequences, I prefer to have them in the form instead of . This is because the former has symmetry which allows it to sum to , while the latter sums to the uglier . Let’s put this information in:

(Note that and must both be positive, and that .) Now, let’s write out the 3 expressions that are supposed to be divisible by :

* A natural next move is to manipulate the relations , and to isolate variables on the right; this will (hopefully) restrict the choices for . *There are a lot of similarities on the RHSes of the 3 relations so we can hope that something simple comes out of it.

gives

and gives

The term is repeated in the 2 relations above! We can subtract one from the other to obtain

Remember that ? This means that is relatively prime to , and so

, i.e.

* This is a big result!* Because of condition (b), we must have , , and . Let’s update our variable diagram:

The new is the easiest to make sense of: must be a multiple of 3. For each value of , we can list the admissible values of and :

At first, as increases, the number of possible triplets increases. For each , the thing that is stopping more possible triplets is hitting up against the constraint that . However, at some point as gets too big, the constraint we hit up against first is .

* Where does this happen?* One might imagine that it happens somewhere in the middle:

If , then when , we have which is **admissible**. Hence, the constraint we hit first is still .

If , then when , we have which is **inadmissible**. Hence the constraint we hit first is now .

Now, note that every time increases from 3 to 48, the number of possibilities increases in increments of 1, from 1 to 16. In the other direction, as decreases from 96 to 51, the number of possibilities increases in increments of 1, from 1 to 16. Putting all this together, the number of possible triplets is

**Done!**