Hofstadter Figure-Figure sequences

FCC link

These two sequences of positive integers are defined as:

$R(1)=1\ ;\ S(1)=2 \\R(n)=R(n-1)+S(n-1), \quad n>1.$

The sequence $S(n)$ is further defined as the sequence of positive integers not present in $R(n)$.

Sequence $R$ starts:

1, 3, 7, 12, 18, ...

Sequence $S$ starts:

2, 4, 5, 6, 8, ...

Test

{{test}}

Console output