fork(1) download
  1. p=[[]]
  2. for n in input():p+=[x+[n][:2>len(x)or n-x[-1]==x[1]-x[0]]for x in p]
  3. print max(p,key=len)
Success #stdin #stdout 0.01s 9016KB
stdin
[5,4,2,-1,-2,-4,-4]
stdout
[5, 2, -1, -4]