OFFSET
1,1
COMMENTS
The sequence starts with a(1) = 2 and is always extended with the smallest integer not yet present that does not lead to a contradiction.
The equivalent sequence where nonprimes and primes exchange their roles is A277997.
LINKS
Jean-Marc Falcoz, Table of n, a(n) for n = 1..10001
EXAMPLE
After a(1) = 2, we cannot have a(2) = 1 as 1 is not a prime number; a(2) = 3 is OK as the absolute difference |2-3| = 1 is a nonprime; the next term a(3) cannot be 5 as the absolute difference |3-5| = 2 is a prime (and we don't want primes in the absolute differences); a(3) = 7 is OK as the absolute difference |3-7| = 4 is a nonprime not yet present in the absolute differences; the next term a(4) cannot be 5 as the absolute difference |7-5| = 2 is a prime; the next term a(4) cannot be 11 as the absolute difference |7-11| = 4 is already in the absolute differences, a(4) = 13 is OK as the absolute difference |7-13| = 6 is a nonprime not yet present in the absolute differences; the next term a(5) is now 5 as |13-5| = 8 is a nonprime not yet present in the absolute differences; the next term a(6) cannot be 11, the smallest available prime, as the absolute difference |5-11| = 6 is a nonprime already present in the absolute differences; a(6) = 17 is OK as |5-17| = 12 is a nonprime not yet present in the absolute differences; the next term a(7) cannot be 11, 19, 23 or 29 for one of the above reasons, but a(7) = 31 is OK as |17-31| = 14 is a nonprime not yet present in the absolute differences; etc.
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini and Jean-Marc Falcoz, Nov 08 2016
STATUS
approved