OFFSET
1,2
COMMENTS
The sequence starts with a(1) and was always extended with the smallest integer not yet present that does not lead to a contradiction. It is conjectured that the sequence together with its first absolute differences is a permutation of the positive integers.
LINKS
Jean-Marc Falcoz, Table of n, a(n) for n = 1..5001
Éric Angelini, Absolute first differences are a permutation of the primes, digest of SeqFan discussion, 2010-10-01.
Éric Angelini, Absolute first differences are a permutation of the primes, local copy of SeqFan discussion, 2010-10-01.
EXAMPLE
After a(1) = 1, we cannot have a(2) = 2 or a(2) = 3 as these are prime numbers; a(2) = 4 is ok as the absolute difference |1-4| = 3 is prime. The next term a(3); cannot be 5 as 5 is prime; a(3) = 6 is ok as the absolute difference |4-6| = 2 is a prime not yet present in the absolute first differences. The next term a(4) cannot be 7 as 7 is prime; nor a(4) = 8 as |6-8| = 2 is a prime already present in the absolute first differences; nor a(4) = 9 as |6-9| = 3 is a prime already present in the first absolute differences; nor a(4) = 10 as |6-10| = 4 is not a prime; nor a(4) = 11 as 11 is prime; nor a(4) = 12 as |6-12| = 4 is not a prime; nor a(4) = 13 as 13 is a prime; nor a(4) = 14 as |6-14| = 4 is not a prime; nor a(4) = 15 as |6-15| = 9 is not a prime; nor a(4) = 16 as |6-16| = 10 is not a prime; nor a(4) = 17 as 17 is a prime; nor a(4) = 18 as |6-18| = 12 is not prime; nor a(4) = 19 as 19 is a prime; nor a(4) = 20 as |6-20| = 14 is not a prime; nor a(4) = 21 as |6-21| = 15 is not a prime; nor a(4) = 22 as |6-22| = 16 is not a prime; nor a(4) = 23 as 23 is a prime; nor a(4) = 24 as |6-24| = 18 is not a prime; a(4) = 25 is ok as |6-25| = 19 is a prime not yet present in the absolute first differences, etc.
PROG
(Python)
from sympy import isprime
from itertools import count, islice
def nextcomposite(n): return next(k for k in count(n+1) if not isprime(k))
def agen(): # generator of terms
an, a, nextc = 1, {1}, 4
while True:
yield an
c = nextc
while c in a or not isprime(abs(c-an)) or abs(c-an) in a:
c = nextcomposite(c)
a.add(c)
a.add(abs(c-an))
an = c
while nextc in a: nextc = nextcomposite(nextc)
print(list(islice(agen(), 74))) # Michael S. Branicky, Dec 23 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Eric Angelini and Jean-Marc Falcoz, Nov 08 2016
STATUS
approved
