Finding the first common number in multiple sequences

160 Views Asked by At

I wanna know if there is a formula/algorithm to get the first common number from multiple sequences. For example:

S1 = 2, 4, 6, 8, 10, 12, ...

S2 = 3, 6, 9, 12, 15, ...

S3 = 4, 8, 12, 16, ...

First common number is 12

If there is a way please let me know, because I've been looking for hours and can't find anything to solve this.