Thank you very much graff ! Your example is very informative and self-explanatory. As for the data itself, it exists in the database in the form I showed, I am free to build the chains of numbers, but they does not exist in the raw form.
Update: I benchmarked your solution with this of mine ( Re^2: Looking for the first item in the chain ) - your code is 48% faster!
In reply to Re^2: Looking for the first item in the chain
by vagabonding electron
in thread Looking for the first item in the chain
by vagabonding electron
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |