<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described.
<END_TASK>
<USER_TASK:>
Description:
Longest subarray forming a Geometic Progression ( GP )
Function to return the length of the longest subarray forming a GP in a sorted array ; Base Case ; Stores the length of GP and the common ratio ; Stores the maximum length of the GP ; Traverse the array ; Check if the common ratio is valid for GP ; If the current common ratio is equal to previous common ratio ; Increment the length of the GP ; Store the max length of GP ; Otherwise ; Update the common ratio ; Update the length of GP ; Store the max length of GP ; Update the length of GP ; Store the max length of GP ; Return the max length of GP ; Given array ; Length of the array ; Function call

<ASSISTANT_TASK:>
Python Code:
def longestGP(A , N ) : 
	 if(N < 2 ) : 
	 return N 
  length = 1 
 common_ratio = 1 
 maxlength = 1 
 for i in range(N - 1 ) : 
	 if(A[i + 1 ] % A[i ] == 0 ) : 
	 if(A[i + 1 ] // A[i ] == common_ratio ) : 
	 length = length + 1 
 maxlength = max(maxlength , length ) 
  else : 
	 common_ratio = A[i + 1 ] // A[i ] 
 length = 2 
   else : 
	 maxlength = max(maxlength , length ) 
 length = 1 
   maxlength = max(maxlength , length ) 
 return maxlength 
  arr =[1 , 2 , 4 , 7 , 14 , 28 , 56 , 89 ] 
 N = len(arr ) 
 print(longestGP(arr , N ) ) 

<END_TASK>
