How many numbers, from 1 to 50 (both included) can you arrange in a row (one of each) so that each one, except the first and the last, is the sum or difference of its two neighbours?

Example: 3, 10, 7, 17, 24, 41.

10 = 3+7, 7 = 17-10, 17 = 24-7, 24 = 41-17.

(In reply to

re: Re Charlie's by Charlie)

Yes, Charlie. I started with eight (since the Fibonacci series was clearly a solution, and when it appeared it would test my code logic). I just added inner loops one at a time until no solutions. I suspected that the list would not be too much longer. My program displayed all solutions for a given length, but not those for shorter lengths; if I added too many loops, and got no hits, I would then have had to remove loops until a solution (preferably unique, other than the reversed pair) appeared. I saw the number drop from several hundred, to 60 or so, to 6, and then to 2, so it appeared the limit was near. A recursive solution would be more elegant, but it was easier to code (using COBOL) by just adding one more variable/loop each time, and re-execution (cycles and wall time) was trivial even for the final pass.