[seqfan] Re: Prime Sums In A Grid

Maximilian Hasler maximilian.hasler at gmail.com
Tue Feb 24 17:50:59 CET 2009


> From: David Wilson <davidwwilson at comcast.net>
> So, can you fill an infinite grid with distinct integers so that any
> two adjacent integers sum to a prime?
On Mon, Feb 23, 2009 at 10:50 PM,  <franktaw at netscape.net> wrote:
> Almost certainly.  Start with
> 1 2
> 4 (...)

Is it reasonable to conjecture that the corresponding sequence (say,
filling this square by antidiagonals in the greedy way) is a
permutation of the positive integers?

Maximilian

[1],
[2, 4],
[3, 9, 7],
[8, 10, 22, 6],
[5, 21, 19, 25, 11],
[12, 26, 40, 18, 36, 20],
[17, 35, 27, 13, 23, 47, 33],
[14, 24, 32, 16, 30, 50, 56, 28],
[15, 29, 65, 51, 31, 53, 57, 45, 39],
[38, 44, 42, 62, 52, 48, 74, 82, 34, 58],
[41, 59, 95, 89, 75, 49, 83, 99, 55, 69, 43],
[60, 68, 54, 78, 92, 64, 90, 80, 94, 112, 70, 46],
[37, 71, 113, 73, 101, 87, 67, 77, 117, 79, 61, 81, 63],
[66, 102, 86, 84, 126, 110, 106, 72, 116, 154, 88, 76, 100, 104],
[85, 91, 125, 107, 97, 131, 123, 121, 155, 153, 103, 105, 151, 93, 119],

Least unused integer so far: 96


/* prime sum grid : fill infinite square grid by antidiagonals such
that sum of 2 neighbours (vertical and horizontal) is always prime */
psg( N=15, last_diag=[1], min_not_used=2, others_used=[])={ local(new_diag);
print(last_diag",");
for( d=1+#last_diag,N /* fill the d-th antidiagonal */,
  #new_diag < d && new_diag=vector( d );
  for( j=1,d,
    ! new_diag[ j ] && new_diag[ j ] = min_not_used + (d-min_not_used)%2;
    while( setsearch( others_used, new_diag[j] )
      | ( j > 1 && setsearch( Set( vecextract( new_diag, 2^(j-1)-1)),
new_diag[j] ))
      | ( j < d && ! isprime( last_diag[ j ] + new_diag[ j ] ))
      | ( j > 1 && ! isprime( last_diag[ j-1 ] + new_diag[ j ] ))
    , new_diag[j] += 2;
    );
  );
  others_used = setunion( others_used, new_diag );
  while( setsearch( others_used, min_not_used )
  , others_used = setminus( others_used, Set( min_not_used )); min_not_used++;
  );
  print( last_diag=new_diag"," ); /* a=concat(a, new_diag ); */
 ); [ min_not_used, others_used ]; }




More information about the SeqFan mailing list