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.

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).

This page as a plain text file.
%I A383730 #28 Jun 01 2025 22:27:29
%S A383730 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,
%T A383730 29,22,21,19,16,20,15,21,14,22,21,23,20,24,19,25,32,40,49,48,50,47,51,
%U A383730 46,52,45,53,44,54,55,57,60,64,59,65,58,66,75,85,74,73,71
%N 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).
%C A383730 This sequence is a bidirectional form of Recamán's sequence.
%C A383730 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).
%C A383730 The sequence is unbounded either above or below.
%C A383730 Conjecture: the sequence is unbounded both above and below.
%C A383730 Conjecture: each integer appears finitely often.
%C A383730 It exhibits a mix of chaotic and periodic behavior, including long plateaus and sudden large jumps.
%C A383730 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.
%H A383730 Markel Zubia, <a href="/A383730/b383730.txt">Table of n, a(n) for n = 0..9999</a>
%H A383730 Markel Zubia, <a href="/A383730/a383730.png">Plot of the first 100k terms</a>
%H A383730 Markel Zubia, <a href="/A383730/a383730_1.png">Close-up of the fractal-like pattern</a>
%H A383730 Markel Zubia, <a href="/A383730/a383730_2.png">Plot of the first 10M terms</a>
%H A383730 Markel Zubia, <a href="/A383730/a383730_3.png">Plot of the first 1B terms</a>
%e A383730 a(1) = 0 + 1.
%e A383730 a(2) = 0 + 1 + 1 = 2, since 0 + 1 - 1 = 0 already appears in the sequence, as a(0) = 0.
%e A383730 a(6) = 0 + 1 + 1 + 2 - 1 + 2 + 3 = 8.
%o A383730 (Python)
%o A383730 def a(n):
%o A383730     t, k, curr = 1, 1, 0
%o A383730     seen = set()
%o A383730     for i in range(n):
%o A383730         seen.add(curr)
%o A383730         step = (-1)**i * t
%o A383730         if curr + step not in seen:
%o A383730             curr = curr + step
%o A383730         else:
%o A383730             curr = curr - step
%o A383730         t += 1
%o A383730         if t > k:
%o A383730             t, k = 1, k + 1
%o A383730     return curr
%Y A383730 Cf. A005132.
%Y A383730 Other bidirectional extensions of Recamán's sequence: A063733, A079053, A064288, A064289, A064387, A064388, A064389, A228474.
%Y A383730 Cf. A002260.
%K A383730 sign,look,hear
%O A383730 0,3
%A A383730 _Markel Zubia_, May 06 2025