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.

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

Original entry on oeis.org

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

Views

Author

Keywords

Comments

The sequence S starts with a(1) = 0 and a(2) = 1. 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 prime. If this is not the case, we then extend the S with the smallest integer X not yet present in S such that [X + the last term Z of the sequence] is not a prime. This is the lexicographically first sequence with this property.

Examples

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

Crossrefs

Cf. A306808 (which is obtained by replacing prime by palindrome in the definition).