SlideShare a Scribd company logo
1 of 1
INVARIENT CONDITION FOR HANOI TOWERS
If we were inclinedtothinkina more mathematical fashion,we mightapproachthisproblemalittle
differently.Luckyforus the mathbehindTowersof Hanoi isverywell understood,butevenif itwasn't
the ideaisthe same.Let'shave a look.
Mathematically, we want to work out a formula for how many steps (Tn) it takes to
transfer n discs from the source to the destination peg. Looking at the smaller cases and counting
the steps manually we see the following.
 when n=1, Tn=1
 when n=2, Tn=3
 when n=3, Tn=7
 when n=4, Tn=15
From this we can start to infer a pattern. Every time we increase the number of discs by 1, we
need to double the number of steps and add 1, which means we can express the number of
steps Tn taken to transfer n discs based on the number of steps taken to transfer n−1 discs:
Tn=2Tn−1+1 where n>0

More Related Content

Viewers also liked

Class 9 & 10 accounting_chapter five_class 7
Class 9 & 10 accounting_chapter five_class 7Class 9 & 10 accounting_chapter five_class 7
Class 9 & 10 accounting_chapter five_class 7Cambriannews
 
Pecha Kucha: My Agile Suitcase for a visit to Waterfall Island
Pecha Kucha: My Agile Suitcase for a visit to Waterfall IslandPecha Kucha: My Agile Suitcase for a visit to Waterfall Island
Pecha Kucha: My Agile Suitcase for a visit to Waterfall IslandPeter Stevens
 
Class 9 & 10 accounting_chapter five_class 6
Class 9 & 10 accounting_chapter five_class 6Class 9 & 10 accounting_chapter five_class 6
Class 9 & 10 accounting_chapter five_class 6Cambriannews
 
Kāpēc KKS nevis bankas
Kāpēc KKS nevis bankasKāpēc KKS nevis bankas
Kāpēc KKS nevis bankasAllazusaime
 
Citología ginecológica. La competencia
Citología ginecológica. La competenciaCitología ginecológica. La competencia
Citología ginecológica. La competenciaCarmen Hidalgo Lozano
 
Presentation1
Presentation1Presentation1
Presentation1maria578
 
Property Portal Watch Barcelona Conference Agenda (2014)
Property Portal Watch Barcelona Conference Agenda (2014)Property Portal Watch Barcelona Conference Agenda (2014)
Property Portal Watch Barcelona Conference Agenda (2014)Property Portal Watch
 

Viewers also liked (11)

Class 9 & 10 accounting_chapter five_class 7
Class 9 & 10 accounting_chapter five_class 7Class 9 & 10 accounting_chapter five_class 7
Class 9 & 10 accounting_chapter five_class 7
 
Pecha Kucha: My Agile Suitcase for a visit to Waterfall Island
Pecha Kucha: My Agile Suitcase for a visit to Waterfall IslandPecha Kucha: My Agile Suitcase for a visit to Waterfall Island
Pecha Kucha: My Agile Suitcase for a visit to Waterfall Island
 
Monografie bun
Monografie bunMonografie bun
Monografie bun
 
Class 9 & 10 accounting_chapter five_class 6
Class 9 & 10 accounting_chapter five_class 6Class 9 & 10 accounting_chapter five_class 6
Class 9 & 10 accounting_chapter five_class 6
 
La célula en esquemas
La célula en esquemasLa célula en esquemas
La célula en esquemas
 
Kāpēc KKS nevis bankas
Kāpēc KKS nevis bankasKāpēc KKS nevis bankas
Kāpēc KKS nevis bankas
 
Machine de pavé
Machine de pavéMachine de pavé
Machine de pavé
 
Citología ginecológica. La competencia
Citología ginecológica. La competenciaCitología ginecológica. La competencia
Citología ginecológica. La competencia
 
Presentation1
Presentation1Presentation1
Presentation1
 
Property Portal Watch Barcelona Conference Agenda (2014)
Property Portal Watch Barcelona Conference Agenda (2014)Property Portal Watch Barcelona Conference Agenda (2014)
Property Portal Watch Barcelona Conference Agenda (2014)
 
arte urbano
arte urbanoarte urbano
arte urbano
 

Similar to Formal Methods In SE

Similar to Formal Methods In SE (14)

Tower of hanoi algorithm
Tower of hanoi algorithmTower of hanoi algorithm
Tower of hanoi algorithm
 
Tower of Hanoi Investigation
Tower of Hanoi InvestigationTower of Hanoi Investigation
Tower of Hanoi Investigation
 
series.pdf
series.pdfseries.pdf
series.pdf
 
Sol38
Sol38Sol38
Sol38
 
Sol38
Sol38Sol38
Sol38
 
Copy of y16 02-2119divide-and-conquer
Copy of y16 02-2119divide-and-conquerCopy of y16 02-2119divide-and-conquer
Copy of y16 02-2119divide-and-conquer
 
Data Structure and Algorithms The Tower of Hanoi
Data Structure and Algorithms The Tower of HanoiData Structure and Algorithms The Tower of Hanoi
Data Structure and Algorithms The Tower of Hanoi
 
Sol18
Sol18Sol18
Sol18
 
Sol18
Sol18Sol18
Sol18
 
Recurrent Problem in Discrete Mathmatics.pptx
Recurrent Problem in Discrete Mathmatics.pptxRecurrent Problem in Discrete Mathmatics.pptx
Recurrent Problem in Discrete Mathmatics.pptx
 
Modeling with Recurrence Relations
Modeling with Recurrence RelationsModeling with Recurrence Relations
Modeling with Recurrence Relations
 
Stochastic Process Assignment Help
Stochastic Process Assignment HelpStochastic Process Assignment Help
Stochastic Process Assignment Help
 
Linear regression
Linear regressionLinear regression
Linear regression
 
RECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEMRECURRENCE EQUATIONS & ANALYZING THEM
RECURRENCE EQUATIONS & ANALYZING THEM
 

Recently uploaded

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 

Recently uploaded (20)

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 

Formal Methods In SE

  • 1. INVARIENT CONDITION FOR HANOI TOWERS If we were inclinedtothinkina more mathematical fashion,we mightapproachthisproblemalittle differently.Luckyforus the mathbehindTowersof Hanoi isverywell understood,butevenif itwasn't the ideaisthe same.Let'shave a look. Mathematically, we want to work out a formula for how many steps (Tn) it takes to transfer n discs from the source to the destination peg. Looking at the smaller cases and counting the steps manually we see the following.  when n=1, Tn=1  when n=2, Tn=3  when n=3, Tn=7  when n=4, Tn=15 From this we can start to infer a pattern. Every time we increase the number of discs by 1, we need to double the number of steps and add 1, which means we can express the number of steps Tn taken to transfer n discs based on the number of steps taken to transfer n−1 discs: Tn=2Tn−1+1 where n>0