Compute optimized LIS having prime numbers in bottom up manner
for i in range ( 1 , n ) : NEW_LINE INDENT if ( not prime [ arr [ i ] ] ) : NEW_LINE lisp [ i ] = 0 NEW_LINE continue NEW_LINE lisp [ i ] = 1 NEW_LINE for j in range ( i ) : NEW_LINE DEDENT