Golomb sequence | Print the first n term of Golomb Sequence ; base cases ; Finding and pring first n terms of Golomb Sequence . ; Driver Code
def Golomb ( n ) : NEW_LINE INDENT dp = [ 0 ] * ( n + 1 ) NEW_LINE dp [ 1 ] = 1 NEW_LINE print ( dp [ 1 ] , end = " ▁ " ) NEW_LINE for i in range ( 2 , n + 1 ) : NEW_LINE INDENT dp [ i ] = 1 + dp [ i - dp [ dp [ i - 1 ] ] ] NEW_LINE print ( dp [ i ] , end = " ▁ " ) NEW_LINE DEDENT DEDENT n = 9 NEW_LINE Golomb ( n ) NEW_LINE