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.

A360692 a(0) = 0. Thereafter a(n+1) = a(a(n)) if a(n) has not occurred previously, otherwise a(n+1) = n - 1 - a(n-1).

Original entry on oeis.org

0, 0, 0, 1, 0, 2, 0, 3, 1, 4, 0, 5, 2, 6, 0, 7, 3, 8, 1, 9, 4, 10, 0, 11, 5, 12, 2, 13, 6, 14, 0, 15, 7, 16, 3, 17, 8, 18, 1, 19, 9, 20, 4, 21, 10, 22, 0, 23, 11, 24, 5, 25, 12, 26, 2, 27, 13, 28, 6, 29, 14, 30, 0, 31, 15, 32, 7, 33, 16, 34, 3, 35, 17, 36, 8
Offset: 0

Views

Author

David James Sycamore, Feb 16 2023

Keywords

Comments

An inductive argument shows that a(n) <= n for all n, with equality iff n = 0. It follows that a(n) is well defined, and the sequence is infinite.
Apart from a(1) = 0 every repeat term is followed by a novel term, and vice versa.
Every nonnegative integer appears infinitely many times.
The proper subsequence given by a(2*k) for k >= 2 is the sequence itself, which is therefore fractal.
Starting from a(1) = 0 the sequence is the nonnegative integers interleaved with itself.

Examples

			a(0) = 0 is a novel term so a(1) = a(a(0)) = 0. Since a(1) is a repeat term a(2) = 0 - a(0) = 0 - 0 = 0. a(1,2) = 0,0 is the only case of consecutive repeat terms.
Since a(2) = 0 is a repeat term, a(3) = 1 - a(1) = 1 - 0 = 1, a novel term so a(4) = a(a(1)) = 0, and so on.
a(16) = 3, a repeat term (last seen at a(7)), so a(17) = 15 - a(15) = 15 - 7 = 8.
		

Crossrefs

Programs

Formula

a(2*n + 1) = n for all n >= 0.
A027383(n) = 0. (n >= 0) gives the positions of all zeros after a(0) = 0.
a((2*k + 3)*2^n - 2) = k (n >= 0) gives the positions of all k > 0.
The number of nonnegative terms occurring between consecutive zeros is 0,0,1,1,3,3,7,7,15,15,... (A000225(n), repeat).
a(n) = A101279(n+2) - 1. - Rémy Sigrist, Feb 18 2023

Extensions

More terms from Rémy Sigrist, Feb 18 2023