cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

User: Markel Zubia

Markel Zubia's wiki page.

Markel Zubia has authored 1 sequences.

A383730 a(0) = 0, a(n) = a(n-1) + A002260(n) * (-1)^(n-1) if not already in the sequence, otherwise a(n) = a(n-1) - A002260(n) * (-1)^(n-1).

Original entry on oeis.org

0, 1, 2, 4, 3, 5, 8, 9, 7, 10, 6, 5, 7, 4, 8, 13, 12, 14, 11, 15, 20, 26, 25, 27, 24, 28, 23, 29, 22, 21, 19, 16, 20, 15, 21, 14, 22, 21, 23, 20, 24, 19, 25, 32, 40, 49, 48, 50, 47, 51, 46, 52, 45, 53, 44, 54, 55, 57, 60, 64, 59, 65, 58, 66, 75, 85, 74, 73, 71
Offset: 0

Author

Markel Zubia, May 06 2025

Keywords

Comments

This sequence is a bidirectional form of Recamán's sequence.
Another way to define the sequence: starting at 0, take steps of size 1, 1, 2, 1, 2, 3, 1, 2, 3, 4, ... alternating left and right while avoiding repeated values (negative values are allowed).
The sequence is unbounded either above or below.
Conjecture: the sequence is unbounded both above and below.
Conjecture: each integer appears finitely often.
It exhibits a mix of chaotic and periodic behavior, including long plateaus and sudden large jumps.
Around term 25000, the sequence settles near -3000 in a visually fractal structure. After ~1.85 million terms, it appears to settle again near -500000. Astonishingly, after ~66.7 million steps, it jumps sharply from around -500000 to +4.51 million.

Examples

			a(1) = 0 + 1.
a(2) = 0 + 1 + 1 = 2, since 0 + 1 - 1 = 0 already appears in the sequence, as a(0) = 0.
a(6) = 0 + 1 + 1 + 2 - 1 + 2 + 3 = 8.
		

Crossrefs

Cf. A005132.
Other bidirectional extensions of Recamán's sequence: A063733, A079053, A064288, A064289, A064387, A064388, A064389, A228474.
Cf. A002260.

Programs

  • Python
    def a(n):
        t, k, curr = 1, 1, 0
        seen = set()
        for i in range(n):
            seen.add(curr)
            step = (-1)**i * t
            if curr + step not in seen:
                curr = curr + step
            else:
                curr = curr - step
            t += 1
            if t > k:
                t, k = 1, k + 1
        return curr