SlideShare a Scribd company logo
1 of 18
nxn Magic square for odd n
Programming topics for first year students
8 1 6
3 5 7
4 9 2
A
 
 
  
 
 
17 24 1 8 15
23 5 7 14 16
4 6 13 20 22
10 12 19 21 3
11 18 25 2 9
A
 
 
 
 

 
 
 
 
row sum= column sum = diagonal sum=15
row sum= column sum = diagonal sum=65
30 39 48 1 10 19 28
38 47 7 9 18 27 29
46 6 8 17 26 35 37
5 14 16 25 34 36 45
13 15 24 33 42 44 4
21 23 32 41 43 3 12
22 31 40 49 2 11 20
A
 
 
 
 
 
  
 
 
 
 
 
How do we create?.
Magic squares
1
N=5
Fill in middle cell of the top row.
Move towards right diagonal.
We cross the grid
1
2
If we cross top boundary , go down to
the column and fill in next number
Rule 1
1
3
2
Move towards right diagonal.
It is unfilled . Fill it with 3
1
4
3
2
Move towards right diagonal.
Boundary crossed. Go to left most cell
Rule 2
1
5
4
3
2
1
5
4 6
3
2
Already Filled
Retrace and go down by one cell
Rule 3
1
5 7
4 6
3
2
1 8
5 7
4 6
3
2
1 8
5 7
4 6
3
9
2
1 8
5 7
4 6
10 3
9
2
1 8
5 7
4 6
10 3
11 9
2
Rule 3
15
1 8
5 16
7 14
4 6 13
10 12 3
11 9
2
Rule 4
Special rule for right top corner cell
17 15
1 8
5 16
7 14
4 6 13
10 12 3
11 18 9
2
17 15
1 8
5 16
7 14
4 6 13 20
10 12 3
19
11 18 9
2
17 15
1 8
5 16
7 14
4 6 13 20
10 12 3
19 21
11 18 9
2
17 15
1 8
5 16
7 14
4 6 22
13 20
10 12 3
19 21
11 18 9
2
Rule 3
17 24 15
1 8
23 5 16
7 14
4 6 22
13 20
10 12 3
19 21
11 18 9
25 2
clear all
% Fill in a odd magic squre from 1 to N^2
% In general numbers must form an Arithmetic
%Progression
N=7; % N must be odd
A=zeros(N,N);
j=1+(N-1)/2 ; % fill centre cell in the first row
i=1; A(i,j)=1
for K=2:N*N
i=i-1; j=j+1; % Advance towards right diagonal
% putback into the matrix if gone out
if and(i<1, j==N+1) i=2; j=N; end
if and (j<=N , i<1) i=N; end
if and (i>0 , j>N) j=1; end
if A(i,j)~=0 i=i+2; j=j-1 ; end
A(i,j)=K;
end
A
30 39 48 1 10 19 28
38 47 7 9 18 27 29
46 6 8 17 26 35 37
5 14 16 25 34 36 45
13 15 24 33 42 44 4
21 23 32 41 43 3 12
22 31 40 49 2 11 20
A
 
 
 
 
 
  
 
 
 
 
 
1. How to create 4x4 magic square
2. How to create mxm magic square
where m =‘odd number’x2
3. What is determinant of odd magic squares
(in relation to the magic sum and why?.)
4. What is so special about Ramanujan’s 4x4
magic square
Recreational mathematics
22/12/1887 is his date of birth. See the top row
Each column/sum is 139
Both Diagonal sum is 139
Corner sum is 139
Blue colour number sum is 139
Pink colour number sum is 139
Blue colour sum is 139
Orange colour sum is 139
Pea Green colour sum is 139
All same colour sum is 139
Blue colour sum is 139
Dark green colour sum is 139
How to create. See the next slide
Magic Square for odd n.pptx

More Related Content

Similar to Magic Square for odd n.pptx

Direct solution of sparse network equations by optimally ordered triangular f...
Direct solution of sparse network equations by optimally ordered triangular f...Direct solution of sparse network equations by optimally ordered triangular f...
Direct solution of sparse network equations by optimally ordered triangular f...Dimas Ruliandi
 
SUEC 高中 Adv Maths (GP Sum to Infinity).pptx
SUEC 高中 Adv Maths (GP Sum to Infinity).pptxSUEC 高中 Adv Maths (GP Sum to Infinity).pptx
SUEC 高中 Adv Maths (GP Sum to Infinity).pptxtungwc
 
Teknik menjawab matematik tambahan 1
Teknik menjawab matematik tambahan 1Teknik menjawab matematik tambahan 1
Teknik menjawab matematik tambahan 1Aidil-Nur Zainal
 
Shape drawing algs
Shape drawing algsShape drawing algs
Shape drawing algsMusawarNice
 
Division of Polynomials.pptx
Division of Polynomials.pptxDivision of Polynomials.pptx
Division of Polynomials.pptxpandavlogsbyJM
 
Ch9-Gauss_Elimination4.pdf
Ch9-Gauss_Elimination4.pdfCh9-Gauss_Elimination4.pdf
Ch9-Gauss_Elimination4.pdfRahulUkhande
 
Chapter 2 - Types of a Function.pdf
Chapter 2 - Types of a Function.pdfChapter 2 - Types of a Function.pdf
Chapter 2 - Types of a Function.pdfManarKareem1
 
Chapter1polarcoordinatesandvector 150105021140-conversion-gate02
Chapter1polarcoordinatesandvector 150105021140-conversion-gate02Chapter1polarcoordinatesandvector 150105021140-conversion-gate02
Chapter1polarcoordinatesandvector 150105021140-conversion-gate02Cleophas Rwemera
 
Applied Calculus Chapter 1 polar coordinates and vector
Applied Calculus Chapter  1 polar coordinates and vectorApplied Calculus Chapter  1 polar coordinates and vector
Applied Calculus Chapter 1 polar coordinates and vectorJ C
 
Math 8 - Linear Inequalities in Two Variables
Math 8 - Linear Inequalities in Two VariablesMath 8 - Linear Inequalities in Two Variables
Math 8 - Linear Inequalities in Two VariablesCarlo Luna
 
Linear Algebra- Gauss Elim-converted.pptx
Linear Algebra- Gauss Elim-converted.pptxLinear Algebra- Gauss Elim-converted.pptx
Linear Algebra- Gauss Elim-converted.pptxMazwan3
 
IIT JAM MATH 2019 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2019 Question Paper | Sourav Sir's ClassesIIT JAM MATH 2019 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2019 Question Paper | Sourav Sir's ClassesSOURAV DAS
 
Sorting and Hashing Algorithm full pdfs.
Sorting and Hashing Algorithm full pdfs.Sorting and Hashing Algorithm full pdfs.
Sorting and Hashing Algorithm full pdfs.NikhilSoni177492
 
Solving Quadratic Equation by Completing the Square.pptx
Solving Quadratic Equation by Completing the Square.pptxSolving Quadratic Equation by Completing the Square.pptx
Solving Quadratic Equation by Completing the Square.pptxDebbieranteErmac
 
Informe laboratorio n°1
Informe laboratorio n°1Informe laboratorio n°1
Informe laboratorio n°1luisescobedo38
 
Alternative Method Constructing Magic Square 3x3 ( Third Order )
Alternative Method Constructing Magic Square 3x3 ( Third Order )Alternative Method Constructing Magic Square 3x3 ( Third Order )
Alternative Method Constructing Magic Square 3x3 ( Third Order )PuworkUtara OnSlideshare
 

Similar to Magic Square for odd n.pptx (20)

Direct solution of sparse network equations by optimally ordered triangular f...
Direct solution of sparse network equations by optimally ordered triangular f...Direct solution of sparse network equations by optimally ordered triangular f...
Direct solution of sparse network equations by optimally ordered triangular f...
 
SUEC 高中 Adv Maths (GP Sum to Infinity).pptx
SUEC 高中 Adv Maths (GP Sum to Infinity).pptxSUEC 高中 Adv Maths (GP Sum to Infinity).pptx
SUEC 高中 Adv Maths (GP Sum to Infinity).pptx
 
Teknik menjawab matematik tambahan 1
Teknik menjawab matematik tambahan 1Teknik menjawab matematik tambahan 1
Teknik menjawab matematik tambahan 1
 
Shape drawing algs
Shape drawing algsShape drawing algs
Shape drawing algs
 
Parcial
ParcialParcial
Parcial
 
Division of Polynomials.pptx
Division of Polynomials.pptxDivision of Polynomials.pptx
Division of Polynomials.pptx
 
Ch9-Gauss_Elimination4.pdf
Ch9-Gauss_Elimination4.pdfCh9-Gauss_Elimination4.pdf
Ch9-Gauss_Elimination4.pdf
 
Chapter 2 - Types of a Function.pdf
Chapter 2 - Types of a Function.pdfChapter 2 - Types of a Function.pdf
Chapter 2 - Types of a Function.pdf
 
Johelbys campos1
Johelbys campos1Johelbys campos1
Johelbys campos1
 
Chapter1polarcoordinatesandvector 150105021140-conversion-gate02
Chapter1polarcoordinatesandvector 150105021140-conversion-gate02Chapter1polarcoordinatesandvector 150105021140-conversion-gate02
Chapter1polarcoordinatesandvector 150105021140-conversion-gate02
 
Applied Calculus Chapter 1 polar coordinates and vector
Applied Calculus Chapter  1 polar coordinates and vectorApplied Calculus Chapter  1 polar coordinates and vector
Applied Calculus Chapter 1 polar coordinates and vector
 
Math 8 - Linear Inequalities in Two Variables
Math 8 - Linear Inequalities in Two VariablesMath 8 - Linear Inequalities in Two Variables
Math 8 - Linear Inequalities in Two Variables
 
Deret aritmatika
Deret aritmatikaDeret aritmatika
Deret aritmatika
 
Linear Algebra- Gauss Elim-converted.pptx
Linear Algebra- Gauss Elim-converted.pptxLinear Algebra- Gauss Elim-converted.pptx
Linear Algebra- Gauss Elim-converted.pptx
 
matrix
matrixmatrix
matrix
 
IIT JAM MATH 2019 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2019 Question Paper | Sourav Sir's ClassesIIT JAM MATH 2019 Question Paper | Sourav Sir's Classes
IIT JAM MATH 2019 Question Paper | Sourav Sir's Classes
 
Sorting and Hashing Algorithm full pdfs.
Sorting and Hashing Algorithm full pdfs.Sorting and Hashing Algorithm full pdfs.
Sorting and Hashing Algorithm full pdfs.
 
Solving Quadratic Equation by Completing the Square.pptx
Solving Quadratic Equation by Completing the Square.pptxSolving Quadratic Equation by Completing the Square.pptx
Solving Quadratic Equation by Completing the Square.pptx
 
Informe laboratorio n°1
Informe laboratorio n°1Informe laboratorio n°1
Informe laboratorio n°1
 
Alternative Method Constructing Magic Square 3x3 ( Third Order )
Alternative Method Constructing Magic Square 3x3 ( Third Order )Alternative Method Constructing Magic Square 3x3 ( Third Order )
Alternative Method Constructing Magic Square 3x3 ( Third Order )
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint23600690
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................MirzaAbrarBaig5
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportDenish Jangid
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesPooky Knightsmith
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
Scopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsScopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsISCOPE Publication
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 

Recently uploaded (20)

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Scopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS PublicationsScopus Indexed Journals 2024 - ISCOPUS Publications
Scopus Indexed Journals 2024 - ISCOPUS Publications
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 

Magic Square for odd n.pptx

  • 1. nxn Magic square for odd n Programming topics for first year students
  • 2. 8 1 6 3 5 7 4 9 2 A            17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 A                  row sum= column sum = diagonal sum=15 row sum= column sum = diagonal sum=65 30 39 48 1 10 19 28 38 47 7 9 18 27 29 46 6 8 17 26 35 37 5 14 16 25 34 36 45 13 15 24 33 42 44 4 21 23 32 41 43 3 12 22 31 40 49 2 11 20 A                        How do we create?. Magic squares
  • 3. 1 N=5 Fill in middle cell of the top row. Move towards right diagonal. We cross the grid 1 2 If we cross top boundary , go down to the column and fill in next number Rule 1
  • 4. 1 3 2 Move towards right diagonal. It is unfilled . Fill it with 3 1 4 3 2 Move towards right diagonal. Boundary crossed. Go to left most cell Rule 2
  • 5. 1 5 4 3 2 1 5 4 6 3 2 Already Filled Retrace and go down by one cell Rule 3
  • 6. 1 5 7 4 6 3 2 1 8 5 7 4 6 3 2
  • 7. 1 8 5 7 4 6 3 9 2 1 8 5 7 4 6 10 3 9 2
  • 8. 1 8 5 7 4 6 10 3 11 9 2 Rule 3 15 1 8 5 16 7 14 4 6 13 10 12 3 11 9 2 Rule 4 Special rule for right top corner cell
  • 9. 17 15 1 8 5 16 7 14 4 6 13 10 12 3 11 18 9 2 17 15 1 8 5 16 7 14 4 6 13 20 10 12 3 19 11 18 9 2
  • 10. 17 15 1 8 5 16 7 14 4 6 13 20 10 12 3 19 21 11 18 9 2 17 15 1 8 5 16 7 14 4 6 22 13 20 10 12 3 19 21 11 18 9 2 Rule 3
  • 11. 17 24 15 1 8 23 5 16 7 14 4 6 22 13 20 10 12 3 19 21 11 18 9 25 2
  • 12. clear all % Fill in a odd magic squre from 1 to N^2 % In general numbers must form an Arithmetic %Progression N=7; % N must be odd A=zeros(N,N); j=1+(N-1)/2 ; % fill centre cell in the first row i=1; A(i,j)=1 for K=2:N*N i=i-1; j=j+1; % Advance towards right diagonal % putback into the matrix if gone out if and(i<1, j==N+1) i=2; j=N; end if and (j<=N , i<1) i=N; end if and (i>0 , j>N) j=1; end if A(i,j)~=0 i=i+2; j=j-1 ; end A(i,j)=K; end A 30 39 48 1 10 19 28 38 47 7 9 18 27 29 46 6 8 17 26 35 37 5 14 16 25 34 36 45 13 15 24 33 42 44 4 21 23 32 41 43 3 12 22 31 40 49 2 11 20 A                       
  • 13. 1. How to create 4x4 magic square 2. How to create mxm magic square where m =‘odd number’x2 3. What is determinant of odd magic squares (in relation to the magic sum and why?.) 4. What is so special about Ramanujan’s 4x4 magic square
  • 15. 22/12/1887 is his date of birth. See the top row Each column/sum is 139 Both Diagonal sum is 139
  • 16. Corner sum is 139 Blue colour number sum is 139 Pink colour number sum is 139 Blue colour sum is 139 Orange colour sum is 139 Pea Green colour sum is 139 All same colour sum is 139 Blue colour sum is 139 Dark green colour sum is 139
  • 17. How to create. See the next slide