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.

A306801 An irregular fractal sequence: underline a(n) iff [a(n-1) + a(n)] is divisible by 3; all underlined terms rebuild the starting sequence.

Original entry on oeis.org

1, 3, 2, 1, 4, 6, 3, 5, 8, 9, 7, 2, 1, 10, 12, 11, 4, 13, 15, 6, 3, 14, 17, 18, 16, 5, 20, 21, 19, 8, 23, 24, 9, 22, 25, 27, 26, 7, 2, 1, 28, 30, 29, 10, 31, 33, 12, 32, 35, 36, 34, 11, 4, 37, 39, 38, 13, 40, 42, 15, 6, 3, 41, 44, 45, 43, 14, 47, 48, 46, 17, 50, 51, 18, 49, 52, 54, 53, 16, 5, 56, 57, 55, 20, 59, 60, 21, 58, 61, 63
Offset: 1

Views

Author

Keywords

Comments

The sequence S starts with a(1) = 1 and a(2) = 3. S is extended by duplicating the first term A among the not yet duplicated terms, under the condition that [A + the last term Z of the sequence] is divisible by 3. If this is not the case, we then extend S with the smallest integer X not yet present in S such that [X + the last term Z of the sequence] is not divisible by 3. This is the lexicographically first sequence with this property.

Examples

			S starts with a(1) = 1 and a(2) = 3.
Can we duplicate a(1) to form a(3)? No, as a(2) + a(3) would be 4 and 4 is not divisible by 3; we thus extend S with the smallest integer X not yet in S such that [X + a(2)]  is not divisible by 3. We get X = 2 and thus a(3) = 2.
Can we duplicate a(1) to form a(4)? Yes, as now [a(1) + a(3)] is divisible by 3; we get thus a(4) = 1.
Can we duplicate a(2) to form a(5)? No, as a(4) + a(2) would be 4 and 4 is not divisible by 3; we thus extend S with the smallest integer X not yet in S such that [X + a(4)]  is not divisible by 3. We get X = 4 and thus a(5) = 4.
Can we duplicate a(2) to form a(6)? No, as a(5) + a(2) would be 7 and 7 is not divisible by 3; we thus extend S with the smallest integer X not yet in S such that [X + a(5)]  is not divisible by 3. We get X = 6 and thus a(6) = 6.
Can we duplicate a(2) to form a(7)? Yes, as now [a(2) + a(6)] is divisible by 3; we get thus a(7) = 3.
Can we duplicate a(3) to form a(8)? No, as a(7) + a(3) would be 5 and 5 is not divisible by 3; we thus extend S with the smallest integer X not yet in S such that [X + a(6)]  is not divisible by 3. We get X = 6 and thus a(8) = 5.
Etc.
		

Crossrefs

Cf. A122196 (which is obtained by replacing 3 by 2 in the definition of this sequence).