An array alternating non-primes

and primes

[Sent: Monday, April 8, 2013 0:00 AM]

Hello SeqFans,

http://oeis.org/A083197... has given me the idea of a variation. Here is A083197:

> Triangular array, read by rows, where

if n is odd the n-th row consists of n least unused non-primes, while

if n is even the n-th row consists of the n least unused primes.

Triangle begins:

1

2 3

4 6 8

5 7 11 13

9 10 12 14 15

17 19 23 29 31 37

etc.

-----------------

... In my variation the size of each row is given by the successive integers of the sequence itself, not by n. Thus the array would begin:

row size & content

1                                     1    (non-prime)

2 3                                   2    (primes)

4 6 8                                 3    (non-primes)

5 7 11 13                             4    (primes)

9 10 12 14 15 16                      6    (non-primes)

17 19 23 29 31 37 41 43               8    (primes)

18 20 21 22 24                        5    (non-primes)

47 51 53 59 61 67 71                  7    (primes)

25 26 27 28 30 32 33 34 35 36 38     11    (non-primes)

...

As A083197, this new sequence is of course a permutation of the natural numbers.

Best,

Ι.

__________

[Maximilian Hasler]:

Dear Eric & SeqFans,

First (yet somehow least important), let me just correct a smallerror, "51" is not prime and so the row starting with 47 should read 47,53,59,61,67,71,73.

Your post inspired me some more ideas:

First, I noticed that your construction can be iterated. The first lines remain the same, but then, due to variing row lengths, primes and non-primes get mixed in different ways.

But the changes appear later and later: In the next step, the sequence would differ due to the row with length 16 instead of 17, and the index of that row is the sum of all preceding numbers (way over 100).

Nonetheless, there is the "limiting" sequence to which the construction converges (which coincides for the abovementioned reason with the (corrected) terms of your example,

1,

2, 3,

4, 6, 8,

5, 7, 11, 13,

9, 10, 12, 14, 15, 16,

17, 19, 23, 29, 31, 37, 41, 43,

18, 20, 21, 22, 24,

47, 53, 59, 61, 67, 71, 73,

25, 26, 27, 28, 30, 32, 33, 34, 35, 36, 38,

79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139,

...

The same definition as A083197, but filling with nonnegative instead of positive integers, yields another variation not in the OEIS:

0

2 3

1 4 6

5 7 11 13

8 9 10 12 14

(The odd rows are just "shifted" by 1 element wrt A083197, due to the initial 0.)

To apply your idea here, we could say that there’d be an initial row 0 with 0 primes, so this empty row zero would be followed by:

row 1 with 2 non-primes : 0, 1,

row 2 with 3 primes :     2, 3, 5

row 3 with 1 non-prime :  4

row 4 with 4 primes :     7, 11, 13, 17

row 5 with 6 composites : 6, 8, 9, 10, 12, 14

etc.

Iterating this construction once more gives:

row 0 with 0 primes,

row 1 with 1 non-primes : 0,

row 2 with 2 primes :     2, 3,

row 3 with 3 non-primes : 1,4,6

row 4 with 5 primes :     5, 7, 11, 13, 17

row 5 with 4 composites : 8, 9, 10, 12

etc.

I think that even and odd sequences of this sequence (of sequences) converge respectively to two distinct limits

0,

2, 3,

1, 4, 6,

5, 7, 11, 13, 17,

8, 9, 10, 12,

19, 23, 29, 31, 37, 41, 43,

14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27,

47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103,

28, 30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50,

...

And

0, 1,

2, 3, 5,

4,

7, 11, 13, 17,

6, 8, 9, 10, 12, 14,

19, 23, 29, 31, 37,

15, 16, 18, 20, 21, 22, 24,

41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83,

25, 26, 27, 28, 30, 32, 33, 34, 35, 36, 38, 39, 40,

...

PS: For my records, I get this by iterating pnp(%,,1) with

{pnp(a,nnp=-1,f=0,na=[],maxrow=10)=np=1;for(n=1,min(maxrow,#a),for(j=1,a[n],

na=concat(na,if(bittest(n,0)==f,np=nextprime(np+1),until(!isprime(nnp++),);nnp));print1(na[#na]","));print);na}

While for your sequences (starting with 1) I have to set the 2nd parameter nnp to 0 and the 3rd (hack to exchange n even<=>odd) to 0

__________

[Hans Havermann]:

Maximilian Hasler:

> 1,

> 2, 3,

> 4, 6, 8,

> 5, 7, 11, 13,

> 9, 10, 12, 14, 15, 16,

> 17, 19, 23, 29, 31, 37, 41, 43,

> 18, 20, 21, 22, 24,

> 47, 53, 59, 61, 67, 71, 73,

> 25, 26, 27, 28, 30, 32, 33, 34, 35, 36, 38,

> 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139,

> ...

If you just want to see more rows, I’ve put another 150 here:

 1 2 3 4 6 8 5 7 11 13 9 10 12 14 15 16 17 19 23 29 31 37 41 43 18 20 21 22 24 47 53 59 61 67 71 73 25 26 27 28 30 32 33 34 35 36 38 79 83 89 97 101 103 107 109 113 127 131 137 139 39 40 42 44 45 46 48 49 50 149 151 157 163 167 173 179 181 191 193 51 52 54 55 56 57 58 60 62 63 64 65 197 199 211 223 227 229 233 239 241 251 257 263 269 271 66 68 69 70 72 74 75 76 77 78 80 81 82 84 85 277 281 283 293 307 311 313 317 331 337 347 349 353 359 367 373 86 87 88 90 91 92 93 94 95 96 98 99 100 102 104 105 106 379 383 389 397 401 409 419 421 431 433 439 443 449 457 461 463 467 479 487 108 110 111 112 114 115 116 117 118 119 120 121 122 123 124 125 126 128 129 130 132 133 134 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593 599 601 607 613 617 619 631 641 643 647 653 659 661 673 135 136 138 140 141 142 143 144 145 146 147 148 150 152 153 154 155 156 158 159 160 161 162 164 165 166 168 169 170 171 172 677 683 691 701 709 719 727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857 859 863 877 881 883 887 907 911 919 929 937 174 175 176 177 178 180 182 183 184 185 186 187 188 189 190 192 194 195 196 198 200 201 202 203 204 205 206 207 208 209 210 212 213 214 215 216 217 218 219 220 221 941 947 953 967 971 977 983 991 997 1009 1013 1019 1021 1031 1033 1039 1049 1051 1061 1063 1069 1087 1091 1093 1097 1103 1109 1117 1123 1129 1151 1153 1163 1171 1181 1187 1193 1201 1213 1217 1223 1229 1231 222 224 225 226 228 230 231 232 234 235 236 237 238 240 242 243 244 245 1237 1249 1259 1277 1279 1283 1289 1291 1297 1301 1303 1307 1319 1321 1327 1361 1367 1373 1381 1399 246 247 248 249 250 252 253 254 255 256 258 259 260 261 262 264 265 266 267 268 270 1409 1423 1427 1429 1433 1439 1447 1451 1453 1459 1471 1481 1483 1487 1489 1493 1499 1511 1523 1531 1543 1549 272 273 274 275 276 278 279 280 282 284 285 286 287 288 289 290 291 292 294 295 296 297 298 299

__________

Many thanks, Maximilian and Hans!

Best,

Ι.