All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Arranging numbers in a row (Posted on 2008-11-20) Difficulty: 2 of 5
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.

See The Solution Submitted by pcbouhid    
Rating: 2.3333 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re(2): Re Charlie's / reply | Comment 9 of 12 |
(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.


  Posted by ed bottemiller on 2008-11-21 11:31:33
Please log in:
Remember me:
Sign up! | Forgot password

Search body:
Forums (2)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Copyright © 2002 - 2020 by Animus Pactum Consulting. All rights reserved. Privacy Information