Posted this in the Extracurricular Secondary Maths thread, only to realise it was Secondary Maths :p. Re-posting here:
Define X(n) & Y(n) in the following manner:
X(1) = Y(1) = 1, otherwise:
X(n)
= 2X(n-1) if n is Even
= 2X(n-1) - 1 if n is Odd
Y(n)
= 2Y(n-1) + 1 if n is Even
= 2Y(n-1)...