human
Count the Arithmetic sequences in the Array of size at least 3 | Function to find all arithmetic sequences of size atleast 3.
If array size is less than 3.
Finding arithmetic subarray length.
To store all arithmetic subarray of length at least 3.
Check if current element makes arithmetic sequence with previous two elements.
Begin with a new element for new arithmetic sequences.
Accumulate result in till i ..
Return final count.
Driver code.
Function to find arithmetic sequences"
Solution in Python:
assistant
#Here is code to count the Arithmetic sequences in the Array of size at least 3 and the other steps required.
 def numberOfArithmeticSequences ( L , N ) :
	if ( N <= 2 ) :
		return 0
	count = 0
	res = 0
	for i in range ( 2 , N ) :
		if ( ( L [ i ] - L [ i - 1 ] ) == ( L [ i - 1 ] - L [ i - 2 ] ) ) :
			count += 1
		else :
			count = 0
		res += count
	return res
L = [ 1 , 3 , 5 , 6 , 7 , 8 ]
N = len ( L )
print ( numberOfArithmeticSequences ( L , N ) )