![]() |
![]() |
#12 |
"Rashid Naimi"
Oct 2015
Remote to Here/There
2,333 Posts |
![]()
Looks like it's gonna be a quiet weekend.
So I will post here. 176 correct submissions and no solutions posted yet. ![]() I assume the challenge is closed. No clue what the May challenge is talking about. Looks like they have decided to raise the bar this month. ![]() |
![]() |
![]() |
![]() |
#13 |
Aug 2002
23·1,069 Posts |
![]() |
![]() |
![]() |
![]() |
#14 | |
"Rashid Naimi"
Oct 2015
Remote to Here/There
233310 Posts |
![]() Quote:
You can run the following code in Pari-GP and then Copy & Paste the output (between the Markings) in Pari-GP to solve any (arbitrary speaking) positive odd number of Rows=Columns except for 19, 1 (and incidentally 0 ![]() For larger Matrices you would need to modify the code so that it outputs to a file rather than the screen. The algorithm is to populate all the Matrix with a prime number (19 in this case) and then increment all cells except for the central one by 6*(number of rows) until a prime is found that restores the prime average criteria. It doesn't take long to get a solution. Code:
\\CTI-100-A by Rashid Naimi \\ Run once in Pari-GP and the Copy the result between the markings and Paste in Pari-GP \\ https://pari.math.u-bordeaux.fr/ allocatemem() theSize = 101 \\\\\Enter an odd number other than 19 (dimension for the number of Rows/Columns) theSize = theSize\2*2+1 { theString =Str(" \\\\\\\\\\\\\\\\\\\\\\\\\\\Start copying from here.\\\\\\\\\\\\\\\\\\\\\\\\\\\ theSize = ",theSize ," a=matrix(theSize ,theSize ) for(i=1,theSize ,{ for(j=1,theSize , a[i,j]=19; ); }) a largestPrime =19; for(i=1,theSize ,{ for(j=1,theSize , if(i==theSize\\2+1 && j==theSize\\2+1 ,next()); a[i,j]=largestPrime +theSize *6; while( !isprime(a[i,j]) || !isprime((a[i,1]");\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ for(k=2,theSize ,theString =Str(theString,"+a[i,",k,"]")); theString =Str(theString,")/theSize ) || !isprime((a[1,j]");\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ for(k=2,theSize ,theString =Str(theString,"+a[",k,",j]")); theString =Str(theString,")/theSize ) || !isprime((a[1,1]");\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ for(k=2,theSize ,theString =Str(theString,"+a[",k,",",k,"]")); theString =Str(theString,")/theSize ) || !isprime((a[1,",theSize ,"]");\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ for(k=2,theSize ,theString =Str(theString,"+a[",k,",",theSize-k+1,"]")); theString =Str(theString,")/theSize ) ,a[i,j]=a[i,j]+theSize *6; ); largestPrime =a[i,j]; ); }) for(i=1,theSize ,print(a[i,])) \\\\\\\\\\\\\\\\\\\\\\\\\\\End copying here & Paste in Pari-GP\\\\\\\\\\\\\\\\\\\\\\\\\\\ "); } print(theString ); Code:
[ 127 397 829 991 1747 3259 3529 4339 5419] [ 5527 7417 7741 8929 11251 13411 14437 15787 16651] [ 16759 22051 25939 29017 29989 32257 34039 35227 39979] [ 42409 44029 47809 59149 60337 61687 62929 64171 65413] [ 65629 65899 70867 73459 19 74377 76213 78427 79399] [ 82531 83773 84691 108991 109639 114661 116443 121789 125353] [129457 130699 148573 149059 149113 153271 158293 158563 162829] [163909 172009 172171 174763 176383 177949 179947 189019 190261] [212239 214129 216829 217369 227251 229249 229897 231409 247609] |
|
![]() |
![]() |
![]() |
#15 |
"Kebbaj Reda"
May 2018
Casablanca, Morocco
11000112 Posts |
![]()
Hi Rachid Naimi,
The question is like this: Find a b c d e f g h i Such the squre : a b c d e f g h i (a+b+c)/3 is prime (d+e+f)/3 prime (g+h+i)/3 prime (a+d+g)/3 prime (b+e+h)/3 prime (c+f+i)/3 prime (a+e+i)/3 prime (c+e+g)/3 prime All a,b,c,d,e,f,g,h,i are primes numbers. It's easy 3x3. Your 9×9 is Fauls: Example: First line 127+397+829+991+1747+3259+3529+4339+5419= 17378 The average is 17378/9 is not integer. Not Prime. Reda Kebbaj. |
![]() |
![]() |
![]() |
#16 |
"Kebbaj Reda"
May 2018
Casablanca, Morocco
32×11 Posts |
![]()
There is a lot of 4X4, 5X5 solution.
Here is one from Professor Barry O'Sulivan,MRIA: 4x4 19 37 31 29 97 17 11 23 43 7 13 109 5 103 61 3 Rows: 29.0 37.0 43.0 43.0 Cols: 41.0 41.0 29.0 41.0 Up: 13.0 Down: 2.0 5x5 29 61 41 31 23 127 17 43 19 89 59 67 3 37 199 83 13 79 11 229 7 107 139 47 5 Rows: 37.0 59.0 73.0 83.0 61.0 Cols: 61.0 53.0 61.0 29.0 109.0 Up: 13.0 Down: 2.0 Thanks to Serge Batalov who made me discover by a post on this forum the first time the sit IBM Ponther This. Reda Kebbaj. |
![]() |
![]() |
![]() |
#17 |
Jun 2003
124748 Posts |
![]() |
![]() |
![]() |
![]() |
#18 |
"Kebbaj Reda"
May 2018
Casablanca, Morocco
32×11 Posts |
![]() ![]() ![]() |
![]() |
![]() |
![]() |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
January 2019 | Xyzzy | Puzzles | 74 | 2019-04-09 13:34 |
March 2019 | Xyzzy | Puzzles | 6 | 2019-04-04 16:32 |
February 2019 | Xyzzy | Puzzles | 17 | 2019-03-07 21:05 |
2019 Coding Challenge | miroslavkures | Number Theory Discussion Group | 2 | 2018-12-27 08:59 |