Problems & Puzzles: Puzzles

 

 

Problems & Puzzles: Puzzles

Puzzle 1275 A Python code to analyze a MS in format CVS

Suppose you are given a Magic square in format CVS.

Here we ask for a Python code that analyze any magic square and confirm or disconfirm the followin fatures of the MS:

1) The MS is a true Magic Square (verifying that all the rows, columns & two main diagonals, sum up to the same quantity)
2) Verify that all the elements of the MG is composed by only distint primes
3) Calculate the smallest and the largest prime in the MS
4) Report the value of the central cell, supposing that the MS is nxn, n=odd.

Q1. Send your best Python Code (or in any other modern computation language of your preference).

Notes:
Please send your code in an attached file to your answer email.
Please work over the
following MS by Roberto Angelone.



 




Contributions came from Carlos Rivera

***
Carlos Rivera wrote:

Me & ChatGPT, developed a Python code with which I analyzed the Roberto Carlo Angelone's MS65651x6561 composed exclusively by consecutive primes. The output of this Pyrhon code was:

Archivo: MM6561.csv
Orden de la matriz: 6561x6561
Elementos analizados: 43046721

VALIDACIONES:
Primalidad: OK
Primos distintos: OK
Magicidad: OK
Primos consecutivos: SI

RANGO DE PRIMOS:
Primo minimo: 44381
Primo maximo: 839097031
Rango de primos: 839052650
Centro C (fila,columna): (3281, 3281)
Valor central C: 403798981

Suma magica SM: 2678155179653
N*C: 2649325114341
SM - N*C: 28830065312
Resultado: SM not equal to N*C

Tiempo total: 529.03 segundos, in a Laptop HP, 11th Gen. i5, 8GB memory RAM.

***

On July 18, 2026, Ankit Chakraborty wrote:

Summary :This code generates a magic square hardcoded to N = 5. Post which it verifies prime non prime numbers inside it. Then it finally checks for the min and max prime numbers in the matrix along with the middle element of the matrix. For  Angelone matrix, since all the numbers are prime it only checks for min and max prime(this time with 729 rows and columns only as the rest have summary data) and also the main element.

***

On July 23, Roberto Carlo Angelone, wrote to Carlos Rivera:
I have managed to escalate another order of 3^n i.e. 3^9x3^9below is a link to the files that make up a 19,683x19,683 Consecutive prime magic square solution.NB solution does not fit in one excel sheet.https://zenodo.org/records/21505577

After that C. Rivera insisted to Robert to send his MS in a single *csv fle (5.6 Gb, by We Tranfer), he finally sent his matrix. Once Rivera received this matrix, he analyzed it by a variation of the Python code mentioned above and its results confirmed the veracity of the claims for the 19,683x19,683 monster sent by Angelone.

Here are the resuts of the code:

MS_ANALYZER_GENERAL_V2.2

RESULTADO DEL ANALISIS

Archivo: MM19683.csv
Orden de la matriz: 19683x19683
Elementos analizados: 387420489

VALIDACIONES:
Primalidad: OK
Primos distintos: OK
Magicidad: OK
Primos consecutivos: SI
RANGO DE PRIMOS:
Primo minimo: 59012329391
Primo maximo: 68650834363
Rango de primos: 9638504972

Centro C (fila,columna): (9842, 9842)
Valor central C: 63826702319

Suma magica SM: 1256300981744877
N * C: 1256300981744877
SM - N * C: 0

Resultado: SM = N*C

Tiempo total: 8067.07 segundos (2.2 hrs)


Editor's note: The author has stated that this construction was produced through human-directed, AI-assisted mathematical research. AI was used during the computational search, software development, verification, and documentation. Responsibility for the mathematical claims remains with the author.


***
  


 

Records   |  Conjectures  |  Problems  |  Puzzles