f s=and[all(j i-2<)[j$i-x|x<-s,x<i]|i<-[1..2*last s]]where j 0=0;j i=1+j(i-last(filter(<=i)s))main = print (f [1,2,3,99])
Standard input is empty
True
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!