human
Count of N digit Numbers having no pair of equal consecutive Digits | Iterative Function to calculate ( x ^ y ) % mod in O ( log y ).
Initialize result.
Update x if x >= mod.
If x is divisible by mod.
If y is odd , multiply x with result.
y must be even now y = y / 2.
Function to count the number of N - digit numbers with no equal pair of consecutive digits.
Base Case.
Driver Code"
How can the above be solved in Python?
 ... Can you provide a code to count of N digit Numbers having no pair of equal consecutive Digits and the other steps required?
assistant
#Here is code to count of N digit Numbers having no pair of equal consecutive Digits and the other steps required.
 def power ( x , y , mod ) :
	res = 1 ;
	x = x % mod ;
	if ( x == 0 ) :
		return 0 ;
	while ( y > 0 ) :
		if ( ( y & 1 ) == 1 ) :
			res = ( res * x ) % mod ;
		y = y >> 1 ;
		x = ( x * x ) % mod ;
	return res ;
def count ( N ) :
	if ( N == 1 ) :
		print ( 10 ) ;
		return ;
	print ( power ( 9 , N , 1000000007 ) ) ;
if __name__ == ' _ _ main _ _ ' :
	N = 3 ;
	count ( N ) ;