I want to count the number of consecutive natural numbers for a list of natural numbers.
For example If {1,2,3,7,9,10,15} then Length @ {1,2,3} = 3 & Length @ {9,10} = 2 and so I should get {{1,2,3},{9,10}} or {3,2} as a result.
However, the result is not shown because the following command is used.
test = {1, 2, 3, 7, 9, 10, 15}; Gather [test, # 1 + 1 == # 2 &]
However, this result is as follows. {{1, 2}, {3}, {7}, {9, 10}, {15}}
I want to ask how to fix it. How to list ArrayFilter?