Given an integer N, the task is to check if N is a Tetradecagonal Number or not. If the number N is an Tetradecagonal Number then print “Yes” else print “No”.
Tetradecagonal Number is 14-sided polygon called Tetrakaidecagon or Tetradecagon and belongs to the figurative number. The nth tetradecagonal number doted with some dots and create a series of the pattern. They have a common sharing corner point and doted with their spaces to each other. The dots continue with nth nested loop.The first few Tetradecagonal Numbers are 1, 14, 39, 76, 125, 186, …
Input: N = 14
Second tetradecagonal number is 14.
Input: N = 40
- The Kth term of the tetradecagonal number is given as
- As we have to check that the given number can be expressed as a Tetradecagonal Number or not. This can be checked as:
- If the value of K calculated using the above formula is an integer, then N is a Tetradecagonal Number.
- Else N is not a Tetradecagonal Number.
Below is the implementation of the above approach:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
In case you wish to attend live classes with industry experts, please refer Geeks Classes Live