OFFSET
1,3
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.
LINKS
Jean-Marc Falcoz, Table of n, a(n) for n = 1..10002
EXAMPLE
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
KEYWORD
base,nonn
AUTHOR
Alexandre Wajnberg and Eric Angelini, Mar 11 2019
STATUS
approved