Absolute first differences are a permutation of the primes

Hello SeqFans,

Would it be possible to build two sequences A & B such that:

A is a permutation of the non-primes

B is a permutation of the primes

and B shows the absolute first differences of A.

I guess A could start like this (if we extend respectively A and B with the "smallest available integer not leading to

A = 1 4 6  25 20  9 16  33  10  39  8  21

B =  3 2 19  5  11 7  17  23  29  31 13

Not sure if this is possible, though...

Best,

É.

__________

[Jim Nastos] was quick to find a bug in my definition:

It depends on how these are being built... B could go 3 2 19 5 11 7 17 13 (instead of 23)

But you would have to be more specific with the "smallest available" rule is applied ...

It looks like you are applying the smallest available rule to a1 a2 b1 a3 b2 a4 b3 ...

But if the smallest integer rule is applied to a1 b1 a2 b2 a3 b3, etc, then b8 should

be 13 instead of 23, but this causes a9 = 46 instead of 10.

This specification should have to be part of the definition, if this ever gets submitted.

[Douglas McNeil] had anticipated Jim’s remark:

Hmm.  I constructed A to be the smallest it could be, giving:

sage: A[:50]

[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]

sage: B[:49]

[3, 2, 19, 17, 7, 5, 11, 13, 23, 43, 31, 29, 47, 41, 53, 37, 61, 79, 67, 59, 83, 71, 89, 103, 97, 73, 109, 127, 101, 107, 191, 113, 137, 281, 151, 157, 131, 139, 227, 149, 167, 347, 163, 173, 283, 179, 229, 181, 199]

[Maximilian Hasler has decided to minimize B]:

Je crois qu’il faudrait spécifier si c’est pour A ou pour B qu’il faut choisir le "smallest available", ce qui ne revient pas forcément au même. Mais je pense que c’est possible... au moins en choisissant la plus petite possibilité pour B.

Pour les premiers 100 termes, j’obtiens les couples [A,B] suivants (valeurs de B avec signe) :

[[1, 3], [4, 2], [6, 19], [25, -5], [20, 7], [27, -11], [16, 17], [33, 13], [46, 23], [69, -29], [40, -31], [9, 41], [50, 37], [87, -43], [44, 47], [91, -53], [38, 61], [99, 59], [158, 67], [225, -71], [154, -73], [81, 79], [160, -83], [77, 89], [166, -101], [65, 97], [162, 103], [265, 107], [372, 109], [481, -113], [368, 127], [495, -131], [364, 137], [501, -139], [362, -149], [213, -151], [62, 157], [219, -163], [56, 179], [235, -167], [68, 181], [249, -173], [76, 191], [267, -193], [74, 199], [273, 197], [470, -211], [259, -223], [36, 239], [275, -227], [48, 241], [289, -229], [60, 263], [323, -233], [90, 251], [341, -257], [84, 271], [355, -269], [86, 277], [363, -281], [82, 283], [365, -293], [72, 313], [385, -307], [78, 317], [395, 311], [706, -331], [375, 337], [712, 347], [1059, -349], [710, -353], [357, 359], [716, 367], [1083, 373], [1456, -379], [1077, -383], [694, -389], [305, 397], [702, -401], [301, 419], [720, -421], [299, 409], [708, 431], [1139, 433], [1572, -439], [1133, -443], [690, 457], [1147, -449], [698, -461], [237, 463], [700, 467], [1167, -479], [688, -487], [201, 491], [692, 499], [1191, 503], [1694, -509], [1185, -521], [664, -523]]

Il est facile de calculer 1000 termes en une fraction de seconde avec le code PARI suivant :

a=[];uA=Set(A=1);uB=[];for(n=1,999, forprime(B=1,default(primelimit),

setsearch(uB,B) & next; (A>B & !setsearch(uA, A-B) & !isprime(A-B)  & B = -B) | ( !setsearch(uA, A+B) & !isprime(A+B)) | next; a=concat(a,[[A,B]]);

uA=setunion(uA,Set(A+=B));uB=setunion(uB,Set(abs(B)));next(2));error())

__________

Ok, Folks, chapter closed in less than an hour after submission, thanks!

Thanks to all contributors,

Best,

É.