4 added 278 characters in body edited Dec 21 '13 at 16:39 DavidC 14k11 gold badge2828 silver badges9090 bronze badges Method 1 How about simply…?  consecQ[a_]:= a===Range[a[[1]],a[[-1]]]  This is based on the assumption that the Mathematica can handle the Range size. Testing consecQ[{0, 3, 2, 1, 4}]  False consecQ[{0, 1, 2, 3, 4}]  True Method2 @A.G. notes that the following can be used if one is concerned about the length of list. If[Last@a - First@a == Length[a] - 1, a == Range[First@a, Last@a], False]  The idea is to first check whether the length of the list is consistent with the first and last elements. TestingMethod 3 This may not be efficient, but it does the job. Assuming that the list consists of integers. consecQ[consecQ2[a_] := Union[Differences[a]] == {1}  Testing consecQ2[{0, 31, 2, 13, 4}]  False consecQ[consecQ2[{0, 13, 2, 31, 4}] consecQ2[{4, 3, 2, 1, 0}]  True False False How about simply…?  consecQ[a_]:= a===Range[a[[1]],a[[-1]]]  This is based on the assumption that the Mathematica can handle the Range size. @A.G. notes that the following can be used if one is concerned about the length of list. If[Last@a - First@a == Length[a] - 1, a == Range[First@a, Last@a], False]  The idea is to first check whether the length of the list is consistent with the first and last elements. Testing consecQ[{0, 3, 2, 1, 4}]  False consecQ[{0, 1, 2, 3, 4}]  True Method 1 How about simply…?  consecQ[a_]:= a===Range[a[[1]],a[[-1]]]  This is based on the assumption that the Mathematica can handle the Range size. Testing consecQ[{0, 3, 2, 1, 4}]  False consecQ[{0, 1, 2, 3, 4}]  True Method2 @A.G. notes that the following can be used if one is concerned about the length of list. If[Last@a - First@a == Length[a] - 1, a == Range[First@a, Last@a], False]  The idea is to first check whether the length of the list is consistent with the first and last elements. Method 3 This may not be efficient, but it does the job. Assuming that the list consists of integers. consecQ2[a_] := Union[Differences[a]] == {1}  Testing consecQ2[{0, 1, 2, 3, 4}] consecQ2[{0, 3, 2, 1, 4}] consecQ2[{4, 3, 2, 1, 0}]  True False False 3 added 310 characters in body edited Dec 21 '13 at 16:28 DavidC 14k11 gold badge2828 silver badges9090 bronze badges How about simply…?  conseqQ[a_]consecQ[a_]:= a===Range[a[[1]],a[[-1]]]  This is based on the assumption that the Mathematica can handle the Range size. @A.G. notes that the following can be used if one is concerned about the length of list. If[Last@a - First@a == Length[a] - 1, a == Range[First@a, Last@a], False]  The idea is to first check whether the length of the list is consistent with the first and last elements.   Testing conseqQ[consecQ[{0, 3, 2, 1, 4}]  False conseqQ[consecQ[{0, 1, 2, 3, 4}]  True How about simply…?  conseqQ[a_]:= a===Range[a[[1]],a[[-1]]]  This is based on the assumption that the Mathematica can handle the Range size. Testing conseqQ[{0, 3, 2, 1, 4}]  False conseqQ[{0, 1, 2, 3, 4}]  True How about simply…?  consecQ[a_]:= a===Range[a[[1]],a[[-1]]]  This is based on the assumption that the Mathematica can handle the Range size. @A.G. notes that the following can be used if one is concerned about the length of list. If[Last@a - First@a == Length[a] - 1, a == Range[First@a, Last@a], False]  The idea is to first check whether the length of the list is consistent with the first and last elements.   Testing consecQ[{0, 3, 2, 1, 4}]  False consecQ[{0, 1, 2, 3, 4}]  True 2 added 91 characters in body edited Dec 21 '13 at 13:57 DavidC 14k11 gold badge2828 silver badges9090 bronze badges How about simply…?  conseqQ[a_]:= a===Range[a[[1]],a[[-1]]]  where aThis is based on the listassumption that the Mathematica can handle the Range size. Testing conseqQ[{0, 3, 2, 1, 4}]  False conseqQ[{0, 1, 2, 3, 4}]  True How about simply…?  a===Range[a[[1]],a[[-1]]]  where a is the list. How about simply…?  conseqQ[a_]:= a===Range[a[[1]],a[[-1]]]  This is based on the assumption that the Mathematica can handle the Range size. Testing conseqQ[{0, 3, 2, 1, 4}]  False conseqQ[{0, 1, 2, 3, 4}]  True 1 answered Dec 21 '13 at 13:51 DavidC 14k11 gold badge2828 silver badges9090 bronze badges