I am new to Julia, and currently stuck on extracting arithmetic progressions from a Vector{Int64} in Julia. Suppose I have a Vector like [1, 4, 5, 3, 9, 21, 16, 2, 22, 54, 17, 23], and I want to extract all consecutive sequences of length three or more. So, from the above, I want to get [1, 2, 3, 4, 5] and [21, 22, 23] as separate vectors. What’s the most efficient way to do this (Preferably without iteration for large vectors)?
I’ve tried using iteration to store and sequentially compare numbers but the memory usage is higher than I would like.