Proper notation for common contiguous sequences within two series?

47 Views Asked by At

Say sequence $A=(1,2,3,4)$ and sequence $B=(1,2,3,4,5)$. How would you formally denote a new sequence of all common subsequences in $A$ and $B$ of length greater than or equal to 4? The resulting sequence in this example would simply be $(1,2,3,4)$. However, I must represent this concept for much longer $A$ and $B$ sequences with many overlaps.

Edit*: As came up in responses, this challenge is close to Longest Common Sequence, but the intention is to only consider contiguous subsequences (and not just those with the same relative order, as is the case in LCM). Also, I must somehow represent all common subsequences and not just the longest. Any help would be much appreciated!