http://qs321.pair.com?node_id=1096910


in reply to Re: Looking for the first item in the chain
in thread Looking for the first item in the chain

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!