2 replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/ edited Apr 13 '17 at 12:55 Clear[g] g[list_, limit_] := Module[{l, l2}, l = (list - limit); l2 = Unitize[l] UnitStep[l] Range[Length[list]]; Split[l2, #1 != 0 && #2 != 0 &] /. {0} -> Sequence[]]; g[x, 2] (*{{3, 4}, {6, 7, 8, 9, 10}, {12, 13}}*)  Testing it with Leonid Shifrin Leonid Shifrin (with only one limit): g[lrgTest, 250] // Length // AbsoluteTiming (*{1.25263, 187504}*)  Clear[g] g[list_, limit_] := Module[{l, l2}, l = (list - limit); l2 = Unitize[l] UnitStep[l] Range[Length[list]]; Split[l2, #1 != 0 && #2 != 0 &] /. {0} -> Sequence[]]; g[x, 2] (*{{3, 4}, {6, 7, 8, 9, 10}, {12, 13}}*)  Testing it with Leonid Shifrin (with only one limit): g[lrgTest, 250] // Length // AbsoluteTiming (*{1.25263, 187504}*)  Clear[g] g[list_, limit_] := Module[{l, l2}, l = (list - limit); l2 = Unitize[l] UnitStep[l] Range[Length[list]]; Split[l2, #1 != 0 && #2 != 0 &] /. {0} -> Sequence[]]; g[x, 2] (*{{3, 4}, {6, 7, 8, 9, 10}, {12, 13}}*)  Testing it with Leonid Shifrin (with only one limit): g[lrgTest, 250] // Length // AbsoluteTiming (*{1.25263, 187504}*)  1 answered Mar 24 '16 at 2:21 Algohi 15.5k11 gold badge2424 silver badges6666 bronze badges Clear[g] g[list_, limit_] := Module[{l, l2}, l = (list - limit); l2 = Unitize[l] UnitStep[l] Range[Length[list]]; Split[l2, #1 != 0 && #2 != 0 &] /. {0} -> Sequence[]]; g[x, 2] (*{{3, 4}, {6, 7, 8, 9, 10}, {12, 13}}*)  Testing it with Leonid Shifrin (with only one limit): g[lrgTest, 250] // Length // AbsoluteTiming (*{1.25263, 187504}*)