Don’t miss the chance of Java programs examples with output pdf free download as it is very essential for all beginners to experienced programmers for cracking the interviews.

Given the number n, the task is to print nth Kynea Number in Python.

Kynea number is a mathematical integer of the type

nth = 4^n + 2^(n + 1) – 1, where n is a positive integer.

Which can be also written as

Â

The initial Kynea numbers are

7, 23, 79, 287, 1087, 4223, 16639,…………..

**Examples:**

**Example1:**

**Input:**

Given nth number =6

**Output:**

The nth Kynea number = 4223

**Example2:**

**Input:**

Given nth number =8

**Output:**

The nth Kynea number = 66047

## Python Program to find the nth Kynea Number

Below are the ways to program to find the nth Kynea Number.

- Using ** operator (Static Input)
- Using ** operator (User Input)
- Using pow operator (Static Input)
- Using pow operator (User Input)

### Method #1: Using ** operator (Static Input)

**Approach:**

- Give the number n as static input and store it in a variable.
- Calculate the power of 2^n using the ** operator and store it in another variable say
**partialres**. - Calculate the value of
**(partialres+1)^2-2Â**using ** and arithmetic operators. - Print the result.
- The Exit of the Program.

**Below is the implementation:**

# Give the number n as static input and store it in a variable. nthNum = 6 # Calculate the power of 2^n using the ** operator # and store it in another variable say partialres. partialres = 2**nthNum # Calculate the value of (partialres+1)^2-2Â # using ** and arithmetic operators. nthresult = (partialres+1)**2-2 # Print the result. print('The nth Kynea number =', nthresult)

**Output:**

The nth Kynea number = 4223

### Method #2: Using ** operator (User Input)

**Approach:**

- Give the number n as user input using int(input()) and store it in a variable.
- Calculate the power of 2^n using the ** operator and store it in another variable say
**partialres**. - Calculate the value of
**(partialres+1)^2-2Â**using ** and arithmetic operators. - Print the result.
- The Exit of the Program.

**Below is the implementation:**

# Give the number n as user input using int(input()) and store it in a variable. nthNum = int(input('Enter some random nth Number = ')) # Calculate the power of 2^n using the ** operator # and store it in another variable say partialres. partialres = 2**nthNum # Calculate the value of (partialres+1)^2-2Â # using ** and arithmetic operators. nthresult = (partialres+1)**2-2 # Print the result. print('The nth Kynea number =', nthresult)

**Output:**

Enter some random nth Number = 9 The nth Kynea number = 263167

### Method #3: Using pow operator (Static Input)

**Approach:**

- Give the number n as static input and store it in a variable.
- Calculate the power of 2^n using the pow function and store it in another variable say
**partialres**. - Calculate the value of
**(partialres+1)^2-2Â**using the pow function and arithmetic operators. - Print the result.
- The Exit of the Program.

**Below is the implementation:**

# Give the number n as static input and store it in a variable. nthNum = 6 # Calculate the power of 2^n using the pow function # and store it in another variable say partialres. partialres = 2**nthNum # Calculate the value of (partialres+1)^2-2Â # using pow function and arithmetic operators. nthresult = (partialres+1)**2-2 # Print the result. print('The nth Kynea number =', nthresult)

**Output:**

The nth Kynea number = 4223

### Method #4: Using pow operator (User Input)

**Approach:**

- Give the number n as user input using int(input()) and store it in a variable.
- Calculate the power of 2^n using the pow function and store it in another variable say
**partialres**. - Calculate the value of
**(partialres+1)^2-2Â**using the pow function and arithmetic operators. - Print the result.
- The Exit of the Program.

**Below is the implementation:**

# Give the number n as user input using int(input()) and store it in a variable. nthNum = int(input('Enter some random nth Number = ')) # Calculate the power of 2^n using the pow function # and store it in another variable say partialres. partialres = 2**nthNum # Calculate the value of (partialres+1)^2-2Â # using pow function and arithmetic operators. nthresult = (partialres+1)**2-2 # Print the result. print('The nth Kynea number =', nthresult)

**Output:**

Enter some random nth Number = 8 The nth Kynea number = 66047

**Related Programs**:

- python program to find the factorial of a number
- python program to find the factors of a number
- python program to find the missing number in an array list
- python program to find the second largest number in a list
- python program to find all numbers in a range which are perfect squares and sum of all digits in the number is less than 10
- python program to find the sum of the digits of the number recursively
- python program to find the power of a number using recursion