Program to find the nth Kynea number | Function to calculate nth kynea number ; Firstly calculate 2 ^ n + 1 ; Now calculate ( 2 ^ n + 1 ) ^ 2 ; Now calculate ( ( 2 ^ n + 1 ) ^ 2 ) - 2 ; return nth Kynea number ; Driver Code ; print nth kynea number
def nthKyneaNumber ( n ) : NEW_LINE INDENT n = ( 1 << n ) + 1 NEW_LINE n = n * n NEW_LINE n = n - 2 NEW_LINE return n NEW_LINE DEDENT n = 2 NEW_LINE print ( nthKyneaNumber ( n ) ) NEW_LINE