# Derek's sequence

**Discrete Mathematics**Level pending

Consider the sequence of complex numbers defined by the recurrence \[ a_{k+1} = \frac{a_k - i}{a_k + i} \text{ for } k \geq 1, \] and let \(a_1\) be any complex number such that \(a_n\) is defined for all positive integers \(n\). For each \(a_1\), let \( S(a_1) \) be the set of all possible values of \( \displaystyle \sum_{k=1}^{p \text{ prime} } (-1)^ka_k\), where \(p\) ranges over the prime numbers. What is \[ \max_{a} |S(a)| ? \]

This problem is posed by Derek K.

**Details and assumptions**

In this problem, \(i\) is the imaginary unit, satisfying \(i^2=-1\).

\( | S | \) denotes the number of **distinct** elements of set \(S\).