human
Sum of the first N terms of XOR Fibonacci series | Function to calculate sum of the first N terms of XOR Fibonacci Series.
Store the sum of first n terms.
Store xor of a and b.
Case 1 : If n is divisible by 3.
Case 2 : If n % 3 leaves remainder 1.
Case 3 : If n % 3 leaves remainder 2 on division by 3.
Print the final sum.
Driver code.
Function call"
Solution in Python:
assistant
#Here is code to sum of the first N terms of XOR Fibonacci series and the other steps required.
 def findSum ( a , b , N ) :
	sum = 0
	x = a ^ b
	if N % 3 == 0 :
		sum = ( N // 3 ) * ( a + b + x )
	elif N % 3 == 1 :
		sum = ( N // 3 ) * ( a + b + x ) + a
	else :
		sum = ( N // 3 ) * ( a + b + x ) + a + b
	print ( sum )
	return
if __name__ == ' _ _ main _ _ ' :
	a = 2
	b = 5
	N = 8
	findSum ( a , b , N )