
- Data Structures & Algorithms
- DSA - Home
- DSA - Overview
- DSA - Environment Setup
- Algorithm
- DSA - Algorithms Basics
- DSA - Asymptotic Analysis
- DSA - Greedy Algorithms
- DSA - Divide and Conquer
- DSA - Dynamic Programming
- Data Structures
- DSA - Data Structure Basics
- DSA - Data Structures and Types
- DSA - Array Data Structure
- Linked Lists
- DSA - Linked List Basics
- DSA - Doubly Linked List
- DSA - Circular Linked List
- Stack & Queue
- DSA - Stack
- DSA - Expression Parsing
- DSA - Queue
- Searching Techniques
- DSA - Linear Search
- DSA - Binary Search
- DSA - Interpolation Search
- DSA - Hash Table
- Sorting Techniques
- DSA - Sorting Algorithms
- DSA - Bubble Sort
- DSA - Insertion Sort
- DSA - Selection Sort
- DSA - Merge Sort
- DSA - Shell Sort
- DSA - Quick Sort
- Graph Data Structure
- DSA - Graph Data Structure
- DSA - Depth First Traversal
- DSA - Breadth First Traversal
- Tree Data Structure
- DSA - Tree Data Structure
- DSA - Tree Traversal
- DSA - Binary Search Tree
- DSA - AVL Tree
- DSA - Red Black Trees
- DSA - B Trees
- DSA - B+ Trees
- DSA - Splay Trees
- DSA - Spanning Tree
- DSA - Tries
- DSA - Heap
- Recursion
- DSA - Recursion Basics
- DSA - Tower of Hanoi
- DSA - Fibonacci Series
- DSA Useful Resources
- DSA - Questions and Answers
- DSA - Quick Guide
- DSA - Useful Resources
- DSA - Discussion
Centered Hexadecagonal Number
Hexadecagonal numbers are the numbers that represent a hexadecagon. Hexadecagon is a polygon which consists of 16 sides.
A Centred Hexadecagonal number is the number represented by a dot in the centre and other dots surrounding it in the successive hexadecagonal layers i.e. 16 sided polygon. We can understand the centred hexadecagonal number better with the below figures.

There is a single dot in the centre for the first centred hexadecagon number. So the first centred hexadecagonal number will be 1.

There is a single dot followed by a hexadecagon surrounding it in the next centred hexadecagon number. So the next number will be 17.

The next centred hexadecagon number will be 49 as there will be a single dot in the centre followed by successive hexadecagonal layers surrounding it i.e. 16 and 32. Thus the number will be 16+32+1=49.
The similar concept will be followed for every nth centred hexadecagon number. With the same reference, the first few centred hexadecagonal number are 1, 17, 49, 97, 161, 241……
The problem statement includes that we need to print the Nth centred hexadecagonal number for the given input N.
For example,
INPUT : 5
OUTPUT : 161
INPUT: 8
OUTPUT: 449
Below is the algorithm to solve the problem.
Algorithm
For this problem, we need to identify the pattern that is being followed in the problem in order to calculate the nth centred hexadecagonal number.
The concept of centred hexadecagonal number says that it is represented by a dot in the centre and successive layers of hexadecagon surrounding it. The successive hexadecagon layers can be represented as 16, 32, 48, 64…. If we pay attention to the pattern formed, it is forming an A.P. with a common difference of 16.
As the first few centred hexadecagon numbers are 1, 17, 49, 97…. If we closely observe the pattern, it is nothing but the sum of successive hexadecagonal layers up to N starting with 0, and 1.
The sequence of successive hexadecagonal layers starting with 0 will be 0, 16, 32, 48, 64….
The 1st centred hexadecagonal number is 1 which is 0+1.
The 2nd centred hexadecagonal number is 17 which is 0+16+1.
The 3rd centred hexadecagonal number is 49 which is 0+16+32+1.
The 4th centred hexadecagonal number is 97 which is nothing but the sum of successive hexadecagonal layers up to N(which is 4) and 1. It can be represented as 0+16+32+48+1.
With the above examples, we can consider that the nth centred hexadecagonal number is the sum of an A.P. of n terms whose common difference is 16 and first term is 0. To calculate the nth term of centred hexadecagonal number, it can be written as −
CHn= sum of n terms of an ap + 1
$$\mathrm{CH_n\:=\:\frac{n}{2}(2a\:+(n-1)d)+1}$$
𝐶𝐻𝑛= nth centred hexadecagonal number
a= first term of the A.P. which is 0
d= common difference of the A.P. i.e. 16
Putting the required values in the above formula, it can be further modified as −
$$\mathrm{CD_n\:=\:\frac{16n}{2}(n-1)+1}$$
$$\mathrm{CD_n\:=\:8n(n-1)+1}$$
We will be using the above derived formula to calculate the nth centred hexadecagonal number in our approach.
Approach
Initialise a function to calculate the Nth centred hexadecagonal number.
Use the above derived formula to calculate the Nth value.
We will initialise a variable to store the value of the nth centred hexadecagonal number.
Return the variable which will be our required output.
Example
Below is the implementation of the approach in C++ −
#include <iostream> #include<bits/stdc++.h> using namespace std; //function to calculate the nth centred Hexadecagonal number int CHn(int N){ int a= 8 * N * (N-1) + 1; //used to store nth centred Hexadecagonal number value return a; //return the answer } int main(){ int N=5; cout<<CHn(N)<<endl; N=10; cout<<CHn(N)<<endl; N=13; cout<<CHn(N)<<endl; return 0; }
Output
161 721 1249
Time Complexity : O(1) , because constant time is taken.
Space Complexity : O(1) , because no extra space is required.
Conclusion
We have tried to learn the concept of centred hexadecagonal number in this article. We also come up with an approach to print the Nth centred hexadecagonal number for any positive number N.
I hope that you find this article helpful to solve all your doubts regarding the concept.
- Related Articles
- Centered Dodecagonal Number
- Centered Tridecagonal Number
- Program for Centered Icosahedral Number in C++
- Program for centered nonagonal number in C++
- Person-Centered Therapy: Carl Rogers
- Client-Centered Therapy: Meaning and Application
- How block elements can be centered using CSS?
- How to disable the centered rotation of Ellipse using FabricJS?
- How to disable the centered scaling of Ellipse using FabricJS?
- How to disable the centered scaling of Circle using FabricJS?
- How to disable the centered rotation of Triangle using FabricJS?
- How to disable the centered rotation of Rectangle using FabricJS?
- How to disable the centered scaling of Rectangle using FabricJS?
- How to enable centered scaling on a canvas using FabricJS?
- How to disable the centered rotation of Text using FabricJS?
