text: Program to print the series 1 , 3 , 4 , 8 , 15 , 27 , 50 â €¦ till N terms | Function to print the series ; Generate the ith term and print it ; Driver Code ; Function Call
code: def printSeries ( n , a , b , c ) : NEW_LINE INDENT if ( n == 1 ) : NEW_LINE INDENT print ( a , end = " ▁ " ) ; NEW_LINE return ; NEW_LINE DEDENT if ( n == 2 ) : NEW_LINE INDENT print ( a , b , end = " ▁ " ) ; NEW_LINE return ; NEW_LINE DEDENT print ( a , b , c , end = " ▁ " ) ; NEW_LINE for i in range ( 4 , n + 1 ) : NEW_LINE INDENT d = a + b + c ; NEW_LINE print ( d , end = " ▁ " ) ; NEW_LINE a = b ; NEW_LINE b = c ; NEW_LINE c = d ; NEW_LINE DEDENT DEDENT N = 7 ; a = 1 ; b = 3 ; NEW_LINE c = 4 ; NEW_LINE printSeries ( N , a , b , c ) ; NEW_LINE