login
a(0) = 0, and then the sequence alternates runs of distinct numbers with the same sign, the n-th run having abs(a(n)) terms; all positive numbers appear, in increasing order; all negative numbers appear, in decreasing order; a(1) = 1.
1

%I #15 Jul 19 2020 04:07:01

%S 0,1,-1,2,3,-2,-3,-4,4,5,-5,-6,-7,6,7,8,9,-8,-9,-10,-11,10,11,12,13,

%T 14,-12,-13,-14,-15,-16,15,16,17,18,19,20,-17,-18,-19,-20,-21,-22,-23,

%U 21,22,23,24,25,26,-24,-25,-26,-27,-28,-29,-30,27,28,29,30,31

%N a(0) = 0, and then the sequence alternates runs of distinct numbers with the same sign, the n-th run having abs(a(n)) terms; all positive numbers appear, in increasing order; all negative numbers appear, in decreasing order; a(1) = 1.

%C This sequence has similarities with Golomb's sequence (A001462) and A113138.

%C Every integer appears once in this sequence.

%H Rémy Sigrist, <a href="/A336264/b336264.txt">Table of n, a(n) for n = 0..10000</a>

%H Rémy Sigrist, <a href="/A336264/a336264.gp.txt">PARI program for A336264</a>

%e a(0) = 0 and a(1) = 1 by definition.

%e So the first run of positive terms has abs(a(1)) = 1 term.

%e a(2) starts the first run of negative terms: a(2) = -1; this run has abs(a(2)) = 1 term.

%e a(3) starts the second run of positive terms: a(3) = 2; this run has abs(a(3)) = 2 terms, so a(4) = 3.

%e a(5) starts the second run of negative terms and has abs(a(4)) = 3 terms: a(5) = -2, a(6) = -3, a(7) = -4.

%o (PARI) See Links section.

%Y Cf. A001462, A113138.

%K sign

%O 0,4

%A _Rémy Sigrist_, Jul 15 2020