Possible Duplicate:
find subsequences of constant increase
Given an arbitrarily long list of integers (let's say they are sorted), how would one determine if any 3 (or more) of those integers make up an arithmetic sequence? (an arithmetic sequence is where the difference between consecutive terms is the same) Also how would one determine all such sequences in a given list?
For instance, I'd like this function to return
In[] = FindArithmSeq[{2,5,6,8,10,12}]
Out[]= {{2,5,8}, {2,6,10}, {6,8,10}, {8,10,12}, {6,8,10,12}}
Thanks in advance!
{2,5,8}? – acl Dec 5 '12 at 1:00