human
Primality Test | Set 5 ( Using Lucas | Function to find out first n terms ( considering 4 as 0 th term ) of Lucas - Lehmer series ..
the 0 th term of the series is 4..
create an array to store the terms ..
compute each term and add it to the array ..
print out the terms one by one ..
Driver program"
How can the above be solved in Python?
 What is a code to primality Test and the other steps required?
assistant
#Here is code to primality Test and the other steps required.
 def LucasLehmer ( n ) :
	current_val = 4 ;
	series = [ ]
	series . append ( current_val )
	for i in range ( n ) :
		current_val = current_val * current_val - 2 ;
		series . append ( current_val ) ;
	for i in range ( n + 1 ) :
		print ( " Term " , i , " : " , series [ i ] )
if __name__ == ' _ _ main _ _ ' :
	n = 5 ;
	LucasLehmer ( n ) ;