The integer sequence proposed by Bernardo Recamán Santos starts at zero. At step , subtract if the result is positive and has not appeared before; otherwise add . The commonly written nonnegative version gives the same sequence because zero is already present. The initial values are . The addition branch can repeat a value: . Avoiding a repeated subtraction is therefore not a global injectivity condition.[ref]
OEIS entry A005132. Definition, initial terms, and comment on the first repeat; correspondence reference dated 29 January 1991
Since , induction gives . A prefix scan needs only constant extra storage but can take quadratic membership work. A bitset-style bounded membership table makes each lookup constant time, while its allocation cost depends on the chosen value universe. This separates the number of generated terms from the range of possible stored values.