Evaluating Occurrence of a Ramanujan Lakshmana Super Magic Square via Deep Learning techniques with Keras

Evaluating Occurrence of a Ramanujan Lakshmana Super Magic Square via Deep Learning techniques with Keras

Have you ever wondered how mathematics and AI could combine to uncover hidden patterns in numbers? Imagine a square so magical that every row, column, diagonal, and even specific sections sum to the same constant—this is the essence of the Ramanujan Lakshmana Super Magic Square.

Inspired by the mathematical brilliance of Ramanujan, this algorithmic marvel goes a step further by integrating the power of deep learning to predict and identify these unique configurations.

What is a Ramanujan Lakshmana Super Magic Square?

Let us first explain what is Ramanujan Square and then later what is Ramanujan Lakshmana Super Magic Square.

Ramanujan Square:

Ramanujan Square

Let us consider a square with its cells as given above.

For this square to be a Ramanujan Magic Square for the birth date ‘dd/mm/ccyy’, (according your region, you can change the format, let us consider Indian Format for simplicity)

Assign values as follows:

  • R1C1 = dd (day)

  • R1C2 = mm (month)

  • R1C3 = cc (century)

  • R1C4 = yy (year)

and fill the remaining cells satisfying the following rules/properties:

Property i: The sum of the numbers of every cell in each row, column and diagonal as well as that of the four corners should be a constant

i.e., [RnC1 + RnC2+ RnC3+ RnC4] = [R1Cn + R2Cn+ R3Cn+ R4Cn] = [R1C1 + R2C2+ R3C3+ R4C4] = [R1C4 + R2C3+ R3C2+ R4C1]  = [R1C1 + R4C1+ R1C4+ R4C4] = constant

Property ii: The sum of the numbers in each 2x2 boxes should be equal to same constant except the [R1C2, R1C3, R2C2, R2C3] and [R3C2, R3C3, R4C2, R4C3] boxes

For example, in the squares shown below, the cells highlighted with the same colour correspond to a box 

2x2 squares

Property iii:  All the numbers of the square must belong to the set of natural numbers N and should be unique with the exception of the first row (in case of repetition in the birth date itself)

On solving for such a square in accordance with the above properties using linear algebra, we obtain the values of each cell of the Ramanujan Square as given below:

Solution to Ramanujan Magical Square

where ‘aa’ and ‘bb’ are variants to be adjusted to fulfil the above property iii

Note:

  1. aa cannot exceed cc + yy; since R2C2 = cc + yy – aa

  2. bb cannot exceed dd + mm and mm + yy; since R3C2 = dd + mm – bb and R3C3 = mm + yy – bb

With the calculation of above formula, Ramanujan birth day square is given below:

Ramanujan Square

This Ramanujan Square is an extraordinary mathematical pattern, where every column, row, diagonal, the four corners, and even adjacent 2x2 squares sum to a consistent total of 139 on the left-hand side of the table. But this excludes the specially highlighted light blue and dark blue squares where Total is not 139 solving a challenge Ramanujan himself couldn’t address!.

To address this, I came with following approach.

Ramanujan Lakshmana Super Magical Square:

If bb = (dd + mm - cc + yy) / 2 then all adjacent 2x2 boxes will satisfy property ii including the [R1C2, R1C3, R2C2, R2C3] and [R3C2, R3C3, R4C2, R4C3] boxes.

Boxes where Ramanujan square fails and if succeeds then it is Ramanujan Lakshmana Super Magic Square.

This square is named as ‘Ramanujan Lakshmana Super Magic Square’

Who will have a Super Magic Square?

For a Super Magic Square, bb = (dd + mm - cc + yy) / 2. Consequently, the table becomes

Solution to Ramanujan Lakshmana Super Magic Square

Corollary: In order for the third row to comply with property iii, dd + mm + cc + yy must be even number and (dd + mm + cc + yy)/2 must be greater than dd, mm, cc and yy.

Let dd, mm, cc take the highest possible values for this century i.e. dd=31, mm=12, cc=20. Now we will find yy to suit the corollary.

=> 31.5 +( yy/2) > {31, 12, 20, yy}

=> 31.5 > (yy/2)

=> yy < 63.

Hence to obtain Super Magic Square for this century, it is necessary to have yy < 63.

My Article Published in Trinity Mirror on Dec 2020

My findings are published in Trinity Paper Dec 2020.

Current year has super magic square on Ramanujan Birthdate as given below where any four numbers—including the light blue and dark blue squares—sum to 78,

 

2024 Ramanujan Birthday with Ramanujan Lakshmana Super Magic Square

You can explore and verify this fascinating mathematical creation interactively through a configurable format of date to the region specific application available at  https://lksmangai.github.io/AngularBirthDate/BirthDateMagicSquare/ to find magic squares based on anyone's birth date.  For those interested in delving deeper into the algorithms and formulas behind generating magical square tables, please check out  https://github.com/lksmangai/DeepLearning/blob/master/article%20ramanujan%20square.pdf  

Now let us know, how to apply deep learning to predict whether magic square and super magic square using Keras.

Keras:

Keras is a powerful high-level neural network API and an easy-to-use, free, open source Python library for developing and evaluating deep learning models in just a few lines of code. It wraps the efficient numerical computation libraries – Theano, TensorFlow, and CNTK and is designed to run on the CPU as well as the GPU.

‘Deep Learning’ steps:

Deep Learning High level Steps

Python Program to illustrate the use of Deep Learning to predict the Occurrence of a Ramanujan Lakshmana Super Magic Square for given dates: 

  1. Load historical data

2. Create training and testing data

3. Define Keras model

4. Compile Keras model

5. Train model on training data

6. Evaluate model on test data

7. Guess predictions via trained model

 

Full Source Code is copied below for the reference:

The same principle can be extended to speedup:

  1.       Chat bots to find suitable answers from given questions’ phrases

  2.       Prescription and medication based on patients’ demographics, vitals and chief complaints

  3.       Preventative maintenance schedule alert based on the sounds or materials used

  4.       Prediction of agriculture yields, weather reports, stock markets, prices and so on…

💬 Let me know your thoughts in the comments!

Additionally, for insights into various technical, business, and cultural topics, feel free to visit or if you have any questions or wish to discuss further, you can reach out to me via:

🌐 LinkedIn: https://www.linkedin.com/in/lakshmanarajsankaralingam/

📧 Email: lksmangai@yahoo.com and 📱 WhatsApp: +91-9225518035.

Let’s spark conversations about how mathematics and AI continue to shape our world.

Let’s celebrate the brilliance of Ramanujan and the joy of mathematics together!

Happy Ramanujan Day! – S. Lakshmanaraj

Lakshmanaraj Sankaralingam, you’ve brilliantly unlocked the magic of Ramanujan's Super Magic Squares! This innovative approach not only honors Ramanujan's genius but also exemplifies how mathematics continues to inspire and captivate. Your work beautifully brings to life this rare phenomenon, showcasing the elegance of mathematical patterns in a way that amazes us all. Kudos for this incredible tribute to a true legend! 🎉👏 #Innovation #RamanujanMagic #MathematicsInspiration"

Gireendra Kasmalkar

Managing Partner, Pentathlon Ventures; Founder & CMD, Ideas to Impacts

2w

Wow! This is fantastic, Lakshmanaraj Sankaralingam!! Proud to have colleagues such as you Ideas To Impacts

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics