PUZZLE IBM-305
Prime Number Generation using GCD
IBM Research · Ponder This · 2023-09
IBM Ponder This #305 · September 2023
This riddle was proposed by Marco Bellocchi - thanks Marco!
Define a sequence
For example, when
Continuing, we arrive at the sequence:
11, 12, 15, 16, 17, 18, 19, 20, 21, 22, 33, 36,...
We now look at the sequence of differences beginning from
1, 3, 1, 1, 1, 1, 1, 1, 1, 11, 3, ...
(i.e.,
A curious property enjoyed by this sequence is that it contains only the number 1 and the prime numbers 3, 11. If we continue this sequence long enough and erase all the occurrences of 1, we arrive at this sequence
3, 11, 3, 23, 3, 47, 3, 5, 3, 101, 3, 7, 11, 3, 13, 233, 3, 467, 3, 5, 3, 941, 3, 7, 1889, ...
which contains only prime numbers. It can be proven that indeed, when
Returning to the original difference sequence, it is easy to see that
Your goal: For the sequence defined by
In addition, find values
A Bonus "*" will be given for finding, for the sequence defined by
Solution
Best opened after a real attemptTo be added.