Search Problems   RSS Feed
projecteuler.net

Complementary Sequences

 Published on Saturday, 31st October 2026, 01:00 pm and solved by 35

Problem 1017

Two strictly increasing sequences $a = (a_n)_{n \ge 0}$ and $b = (b_n)_{n \ge 0}$ have the following properties:

  • $b_n = a_n + a_{n + 1} + a_{n + 2}$ for each $n$;
  • every positive integer appears either in $a$ or in $b$, but not in both.

The sequences begin with: $$\begin{align} a & \colon 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 14, 15, 17, 18, 19, 21, \dots\\ b & \colon 6, 9, 12, 16, 20, \dots \end{align}$$

If we take the bitwise-xor of $b_n - 1$ for all $b_n$ that do not exceed $20$, then we get $5 \oplus 8 \oplus 11 \oplus 15 \oplus 19 = 26$, where $\oplus$ represents bitwise-xor.

Find the bitwise-xor of $b_n - 1$ for all $b_n$ that do not exceed $10^{18}$.



Copied to Clipboard