OFFSET
1,2
COMMENTS
Following ideas from Leroy Quet, D. Wilson and F. Adams-Watters, cf. link.
Can we conjecture that this is a permutation of the positive integers?
LINKS
D. Wilson and F. Adams-Watters in reply to Leroy Quet, Prime Sums In A Grid, SeqFan list, Feb 24 2009
EXAMPLE
The antidiagonals of the array form the following triangle, where each number must add up to a prime with its neighbors above:
____________________________ 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
PROG
(PARI) A157182( n, show=0/*set to 1 to print everything instead*/, last_diag=[1], min_not_used=2, others_used=[])={ local(new_diag); n-- || return(1); for( d=1+#last_diag, 1+sqrtint(2*n), /* fill the d-th antidiagonal */ show & print(last_diag, ", "); 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; ); show || n-- || return(new_diag[j]) ); 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++; ); last_diag=new_diag; /* a=concat(a, new_diag ); */ ); [ min_not_used, others_used ]; }
CROSSREFS
KEYWORD
AUTHOR
M. F. Hasler, Feb 24 2009
STATUS
approved