Methodically filling successive squares and primes with N

 

 

[June 16th, 2010]

 

Hello SeqFans,

 

We want the successive squares to be replaced by sums in this way:

 

 n = 1  2  3   4   5   6   7   8   9   10   11   12 ...

n^2= 1  4  9  16  25  36  49  64  81  100  121  144

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

Sum  1  4  2   3   6  11  14  16  18   22   26   30

           +   +   +   +   +   +   +    +    +    +

           7   5   9  12  15  17  19   24   27   32

               +   +   +   +   +   +    +    +    +

               8  10  13  20  31  21   25   28   33

                                   +    +    +    +

                                  23   29   40   49

 

Thus, to complete a sum, we always use the smallest available positive integer not used so far and not leading to a contradiction.

 

The sequence arising from this could be (this is a permutation of N):

 

Sq = 1,4,2,7,3,5,8,6,9,10,11,12,13,14,15,20,16,17,31,18,19,21,23, ...

 

 

The same algorithm can be used to "fill the Primes":

 

  2   3   5   7   11   13   17   19   23   29   31   ...

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

  2   3   1   7    5   13    8   19   11   14   10

          +        +         +         +    +    +

          4        6         9        12   15   21

 

... producing:

 

Pr = 2,3,1,4,7,5,6,13,8,9,19,11,12,14,15,10,21, ...

 

Neither "Sq" nor "Pr" are in the OEIS. If someone could check, extend those seq and submit them (in September -- if they are of interest), it would be nice.

 

Best,

É.

 

_______________

 

[Douglas McNeil, a couple of hours later]

 

 

Can’t submit it myself, but FYI (and hopefully for comparison with someone else’s values):

 

sage: Sq

[1, 4, 2, 7, 3, 5, 8, 6, 9, 10, 11, 12, 13, 14, 15, 20, 16, 17, 31, 18, 19, 21, 23, 22, 24, 25, 29, 26, 27, 28, 40, 30, 32, 33, 49, 34, 35, 36, 64, 37, 38, 39, 82, 41, 42, 43, 44, 55, 45, 46, 47, 48, 70, 50, 51, 52, 53, 83, 54, 56, 57, 58, 99, 59, 60, 61, 62, 119, 63, 65, 66, 67, 68, 71, 69, 72, 73, 74, 75, 78, 76, 77, 79, 80, 81, 91, 84, 85, 86, 87, 89, 98, 88, 90, 92, 93, 95, 118, 94, 96, 97, 100, 101, 137, 102, 103, 104, 105, 106, 156, 107, 108, 109, 110, 111, 184, 112, 113, 114, 115, 116, 214, 117, 120, 121, 122, 123, 238, 124, 125, 126, 127, 128, 129, 141, 130, 131, 132, 133, 134, 135, 166, 136, 138, 139, 140, 142, 143, 186, 144, 145, 146, 147, 148, 149, 210, 150, 151, 152, 153, 154, 155, 241, 157, 158, 159, 160, 161, 162, 268, 163, 164, 165, 167, 168, 169, 300, 170, 171, 172, 173, 174, 175, 334, 176, 177, 178, 179, 180, 181, 182, 191, 183, 185, 187, 188, 189, 190, 192, 207, 193, 194, 195, 196, 197, 198, 199, 228, 200, 201, 202, 203, 204, 205, 206, 260, 208, 209, 211, 212, 213, 215, 216, 280, 217, 218, 219, 220, 221, 222, 223, 309, 224, 225, 226, 227, 229, 230, 231, 344, 232, 233, 234, 235, 236, 237, 239, 379, 240, 242, 243, 244, 245, 246, 247, 409, 248, 249, 250, 251, 252, 253, 254, 452, 255, 256, 257, 258, 259, 261, 262, 496, 263, 264, 265, 266, 267, 269, 270, 537, 271, 272, 273, 274, 275, 276, 277, 278, 304]

 

sage: Pr

[2, 3, 1, 4, 7, 5, 6, 13, 8, 9, 19, 11, 12, 14, 15, 10, 21, 17, 20, 16, 25, 43, 18, 29, 22, 31, 23, 36, 24, 37, 26, 41, 27, 44, 28, 45, 30, 49, 32, 51, 33, 56, 34, 63, 35, 66, 38, 65, 39, 68, 40, 69, 42, 71, 46, 81, 47, 84, 48, 89, 52, 87, 50, 99, 53, 98, 54, 103, 55, 108, 57, 110, 58, 115, 59, 120, 60, 121, 61, 130, 62, 64, 67, 70, 127, 73, 126, 72, 139, 74, 149, 75, 152, 76, 153, 77, 156, 78, 79, 82, 80, 161, 83, 168, 85, 172, 86, 177, 88, 90, 91, 92, 179, 93, 184, 94, 187, 95, 188, 96, 97, 100, 101, 102, 104, 105, 206, 106, 207, 107, 210, 109, 222, 111, 112, 114, 113, 116, 118, 117, 232, 119, 234, 122, 237, 123, 244, 124, 249, 125, 254, 128, 255, 129, 260, 131, 132, 134, 133, 268, 135, 136, 138, 137, 140, 142, 141, 280, 143, 288, 144, 289, 145, 146, 148, 147, 296, 150, 299, 151, 306, 154, 307, 155, 308, 157, 310, 158, 159, 162, 160, 163, 164, 165, 326, 166, 333, 167, 336, 169, 340, 170, 171, 180, 173, 174, 176, 175, 181, 185, 178, 183, 186, 182, 375, 189, 374, 190, 379, 191, 380, 192, 385, 193, 194, 200, 195, 196, 202, 197, 198, 204, 199, 402, 201, 406, 203, 410, 205, 412, 208, 411, 209, 422, 211, 212, 218, 213, 214, 216, 215, 432, 217, 436, 219, 440, 220, 441, 221, 223, 229, 224, 225, 228, 226, 227, 230, 231, 460, 233, 468, 235, 236, 238, 239, 480, 240, 241, 246, 242, 243, 248, 245, 494, 247, 496, 250, 501, 251, 506, 252, 253, 256, 257, 512, 258, 515, 259, 261, 267, 262, 263, 272, 264, 266, 279, 265, 269, 277, 270, 273, 278, 271, 552, 274, 553, 275, 554, 276, 281, 282, 283, 284, 286, 285, 572, 290, 569, 287, 576, 291, 292, 294, 293, 588, 297, 586, 295, 592, 298, 300, 309, 301, 610, 302, 303, 314, 304, 305, 320, 311, 626, 312, 313, 316, 315, 632, 317, 636, 318, 319, 330, 321, 322, 328, 323, 325, 329, 324, 327, 332, 331, 660, 334, 663]

 

Your sequences are always fun to program!

 

Doug

 

_______________

 

[Me, a couple of seconds later]

 

Again, many, many thanks, Doug! And yes, please submit and co-author in September (...)!

Best,

É.