Magical Land - MATLAB Cody - MATLAB Central

Problem 55360. Magical Land

Mother Earth has gifted humanity a magical land to help all life on earth, in the shape of a n-sided regular polygon.
You, being a good samaritan has volunteered to help.
The land has directional properties, and is to be divided accordingly. The magical properties can only be utilized if the following conditions are met -
  1. All divided parts must be quadrilaterals.
  2. Exactly (n/2-1) people should have the access to the land. One part (quadrilateral) per person.
For example
n=6 %A regular hexagon to be divided in 6/2-1 = 2 parts
There are 3 ways of dividing -
1 > ABCDA-DEFAD
2 > BCDEB-EFABE
3 > CDEFC-FABCF
%ABCDA, BCDEB and CDEFC are identical on paper, but since the land has directional properties
%they are counted different here
n=8 %A regular octagon to be divided in 8/2-1 = 3 parts
1 > ABCDA-DEFGD-ADGHA
2 > ABCDA-DEHAD-EFGHE
%and so on
So, Given n, return, in how many ways the land can be divided according to the conditions.
note - n will be an even natural number.

Solution Stats

70.0% Correct | 30.0% Incorrect
Last Solution submitted on Jul 05, 2024

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers7

Suggested Problems

More from this Author31

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!