login
A277997
Lexicographically first sequence of nonprimes (with no duplicates) whose absolute first differences are prime (with no duplicates).
2
1, 4, 6, 25, 8, 15, 10, 21, 34, 57, 14, 45, 16, 63, 22, 75, 38, 99, 20, 87, 28, 111, 40, 129, 26, 123, 50, 159, 32, 133, 240, 49, 162, 299, 18, 169, 12, 143, 282, 55, 204, 371, 24, 187, 360, 77, 256, 27, 208, 9, 202, 399, 46, 279, 56, 267, 506, 39, 280, 531, 44, 301, 30, 323, 54, 361, 48, 325, 62, 393, 76, 387, 724, 33
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
É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
Sequence in context: A165164 A241602 A136591 * A009459 A239625 A123055
KEYWORD
nonn
AUTHOR
STATUS
approved