Category Archives: Mathematical

Convert Number n to 1 in Minimum Steps

Given a number n (n>=1 && n<=1018), your task is to convert it to 1 in minimum operation and constant space and time complexity. In one operation you can either – Subtract 1 from n if n>1. (or) Divide n by one of its proper divisor. Examples:- Input: n=2 Output: 1 2–>1. first move:- subtract 1 from n… Read More »

Find the Nth Triacontakaihenagonal Number

Given a number N, the task is to find Nth triacontakaihenagonal number. A triacontakaihenagonal number is class of figurate number. It has 31 – sided polygon called triacontakaihenagon. The N-th triacontakaihenagonal number count’s the 31 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The first few triacontakaihenagonol numbers… Read More »

Check if a Number is Pentacontagon

Given an integer N, the task is to check if it is a pentacontagon number or not. Pentacontagon number is class of figurate number. It has 50 – sided polygon called pentacontagon. The N-th pentacontagon number count’s the 50 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The… Read More »

Check if a Number is Triacontakaidigon

Given an integer N, the task is to check if it is a Triacontakaidigon number or not. Triacontakaidigon number is class of figurate number. It has 32 – sided polygon called Triacontakaidigon. The N-th triacontakaidigon number count’s the 32 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The… Read More »

Check if a Number is Hexacontagon

Given an integer N, the task is to check if it is a hexacontagon number or not. Hexacontagon number is class of figurate number. It has 60 – sided polygon called hexacontagon. The N-th hexacontagon number count’s the 60 number of dots and all others dots are surrounding with a common sharing corner and make a pattern. The… Read More »