Ed, Numbers 1 through 23 with adjacents adding to perfect squares: 18-7-9-16-20-5-11-14-22-3-1-8-17-19-6-10-15-21-4-12-13-23-2 Interestingly enough, this becomes circular if the number 18 is removed. Clinton Weaver ------------------------------------------------------------ Ed, After an exhaustive (I hope) search by hand I found three solutions: 18- 7- 2-23-12-12- 4-21-15-10- 6-19-17- 8- 1- 3-22-14-11- 5-20-16- 9 18- 7- 9-16-20- 5-11-14-22- 3- 1- 8-17-19- 6-10-15-21- 4-12-13-23- 2 18- 7- 9-16-20- 5-11-14- 2-23-13-12- 4-21-15-10- 6-19-17- 8- 1- 3-22 18 is the only number with one possible pairing 18+7=25 Notice the first and second just have the last 21 terms reversed and the second and third just have the last 15 terms reversed There are also (at least) 8 solutions if one number is left out. -Jeremy Galvagni ------------------------------------------------------------------- My solution is - if I under stood the question 18 7 9 16 20 5 11 14 22 3 1 8 17 19 6 10 15 21 4 12 13 23 2 Tony Costello ------------------------------------------------------------------- A - 18 7 9 16 20 5 11 14 22 3 1 8 17 19 6 10 15 21 4 12 13 23 2 This is probably really old and you've had heaps of correct answers, but I've only just come across the problem! Cheers Alison Campbell Adelaide, South Australia ------------------------------------------------------------------- I found two closely related answers. / 22 3 1 8 17 19 6 10 15 21 4 12 13 23 2 18 7 9 16 20 5 11 14 < \ 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 Warren Phillips -------------------------------------------------------------------- Here's my solution to your latest puzzles. I found them fairly easy but very nice! 1. The neighbour's square sums 18 has just one possible neighbour, the 7. So the sequence has to start with 18-7-... Then a closer look to some other numbers show that they have just two possible neighbours: 5-11-14, 6-10-15, 4-12-13, 7-9-16-20-5, 8-17-19-6, 4-21-15, 3-22-14, 2-23-13. Now try to order these possible fragments: 18-7, 7-9-16-20-5, 5-11-14, 14-22-3, ?, 8-17-19-6, 6-10-15, 15-21-4, 4-12-13, 13-23-2. There's just one number missing, the 1, and it can happily be used as a link between 3 and 8! So you get the solution: 18-7-9-16-20-5-11-14-22-3-1-8-17-19-6-10-15-21-4-12-13-23-2. 2. The 6x6 chessboard puzzle Number the rows ands columns from left to right and bottom to top with 1 to 6. Suppose the cell (1,1) to be black. Now all the cells with the same parity of column AND row numbers have to be black, too while the others have to be white. For six non-attacking rooks you have to use each row and each column just once, e.g. the rooks may be on (1,3), (2,5), (3,1), (4,6), (5,2) and (6,4). But four of these cells are black and only two are white. So you cannot cover the rest of the board with fifteen dominoes each of which has to cover one black and one white cell. Now the question is: Is it possible to find six cells of which just three are white for the rooks? But then you have to find three cells of (odd, even)- or (even, odd)-combination using the SAME number (3) of odd and even numbers while the remaining three cells must be of an (odd, odd)- or (even, even)-combination using 0, 2, 4 or 6 even numbers! So it's impossible. Happy puzzling! Franz-Josef Schulte --------------------------------------------------------------------- The Answer of "Arrange the numbers 1 to 23 in ....." is " 2-23-13-12-4-21-15-10-6-19-17-8-1-3-22-14-11-5-20-16-9-7-18 " --- It became cold rapidly. I feel nowadays winter has come. Take care! --Koshi Arai --------------------------------------------------------------------- 18,7,9,16,20,5,11,14,22,3,1,8,17,19,6,10,15,21,4,12,13,23,2 And a belated Happy Thanksgiving. I am somewhat certain that this series is unique up to reversal (I believe every step wa forcing, but did not go over my work to make absolutely sure). The first step was to see that 18 has to be an endpoint and work from there. In this case I used a spreadsheet and scrap paper (didn't go so far as to write a program). Cheers, Lyman --------------------------------------------------------------------- The answer is: 18-7-2-23-13-12-4-21-15-10-6-19-17-8-1-3-22-14-11-5-20-16-9 Blaine G. Gibson --------------------------------------------------------------------- --- CALVER BYRON > 2-23-13-12-4-21-15-10-6-19-17-8-1-3-22-14-11-5-20-16-9-7-18 -------------------------------------------------------------------- Arrange the numbers 1 to 23 in a line so that each adjacent pair of numbers sums to a square number: 18 7 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 14 11 5 20 16 9 Fatih Keles ------------------------------------------------------------------- "Arrange the numbers 1 to 23 in a line so that each adjacent pair of numbers sums to a square number." Six answers total: 18-7-9-16-20-5-11-14-2-23-13-12-4-21-15-10-6-19-17-8-1-3-22 18-7-2-23-13-12-4-21-15-10-6-19-17-8-1-3-22-14-11-5-20-16-9 18-7-9-16-20-5-11-14-22-3-1-8-17-19-6-10-15-21-4-12-13-23-2 And the reversals of the above three. Alan Lemm ---------------------------------------------------------------------] Hi Ed! This problem looked fairly easy, but I couldn't find an easy to explain solution. Did I overlook something? I found two answers, which can of course be reversed: 18, 7, 9, 16, 20, 5, 11, 14, followed by either 2, 23, 13, 12, 4, 21, 15, 10, 6, 19, 17, 8, 1, 3, 22 or its reversal, because 14 can be followed by 2 or 22. Solution: 1) List the 28 ordered pairs of numbers that sum to a square (4, 9, 16, 25, or 26). 2) Create a table of the pairs for each number 3) Note that 18 has only one pair, (7, 18), so start with 18, 7 4) Continue adding to the sequence by removing used numbers from the table and using numbers that have only have one pair remaining. This produces the sequence: 18, 7, 9, 16, 20, 5, 11, 14 This is the point where it becomes difficult to explain my solution. There are two valid choices, 2 or 22. Continuing with 2 produces the sequence: 2, 23, 13 and the choice to follow with 3 or 12. Instead of continuing to try to add to the sequence so far, I chose to create valid sequences that had to fit somewhere in the final answer. Doing this, I soon had the sequence 2, 23, 13, 12, 4, 21, 15, 10, 6, 19, 17, 8, 1, 3, 22. - Ron Zeno ---------------------------------------------------------------------- I found 3 sequences: 18 7 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 14 11 5 20 16 9 18 7 9 16 20 5 11 14 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 18 7 9 16 20 5 11 14 22 3 1 8 17 19 6 10 15 21 4 12 13 23 2 Reverse of these sequences holds the truth as well. Ashish ---------------------------------------------------------------------- Arrange the numbers 1 to 23 in a line so that each adjacent pair of numbers sums to a square number. My solution: 18-7-9-16-20-5-11-14-22-3-1-8-17-19-6-10-15-21-4-12-13-23-2 Comments: #1. Of course, 18 can only be paired with 7, so 18-7- has to be one end. #2. Then 7 can pair with either 2 or 9. If 2, then since 9 can only otherwise pair with 16, it would have to be the other end. So the sol is either 18-7-2-...-9 or 18-7-9-.... But if 18-7-2-...-9 is a sol, then so is 18-7-(reverse of same 2-...-9), which is a subset of 18-7-9-.... Therefore, we don't have to consider 18-7-2-...-9 since it's only a special case that we can deduce from 18-7-9-.... #3. Considering only 18-7-9, then we are forced to continue 18-7-9-16-20-5-(4 or 11). But like 9 above, 11 then only has one possible continuation (14). Therefore, like 2 above, we don't have to consider 4. So 18-7-9-16-20-5-11-14. #4. Continuing, 18-7-9-16-20-5-11-14-(2 or 22). Since 22 has only one possible continuation (3), we don't have to consider 2. Since 2's remaining partner is 23, the end must be -23-2; continuing backwards yields (12 or 3)-13-23-2. #5. Thus, 18-7-9-16-20-5-11-14-22-3-(1 or 6 or 13). Since we have now used the 3, the end must be -12-13-23-2. Continuing backwards perforce yields -15-21-4-12-13-23-2; therefore 13 cannot follow the 3. This end must be preceded by either 6-19-17-8-1 or 6-10; therefore 3 cannot be followed by 6. Thus 3 must be followed by 1. #6. Continuing from the beginning, 18-7-9-16-20-5-11-14-22-3-1-, which cannot be followed by 15 (which is used in the end). Therefore it must be followed by 8, leaving the 10 to precede the 15. Thus we have 18-7-9-16-20-5-11-14-22-3-1-8-...-10-15-21-4-12-13-23-2. The intervening remainder is forced: 8-17-19-6-10 Because of points #2 and #4, two non-trivial alternate sols can be deduced by reversing parts of the above sol: 18-7-2-23-13-12-4-21-15-10-6-19-17-8-1-3-22-14-11-5-20-16-9 18-7-9-16-20-5-11-14-2-23-13-12-4-21-15-10-6-19-17-8-1-3-22 William J. Flis -------------------------------------------------------------------- Here is how to align the numbers 1 through 23 such that each pair of adjacent numbers adds to a perfect square: 2, 23, 13, 12, 4, 21, 15, 10, 6, 19, 17, 8, 1, 3, 22, 14, 11, 5, 20, 16, 9, 7, 18 also solvable as 22, 3, 1, 8, 17, 19, 6, 10, 15, 21, 4, 12, 13, 23, 2, 14, 11, 5, 20, 16, 9, 7, 18 The segment from 2 to 22 is reversible. -------- Chris Conrey ----------------------------------------------------------------- Dear Ed, How about 18, 7, 9, 16, 20, 5, 11, 14, 22, 3, 1, 8, 17, 19, 6, 10, 15, 21, 4, 12, 13, 23, 2? My second year class of 12-13 year olds have got this as a challenge to do!! Nasty old sir!!!! Cheers, Alastair ----------------------------------------------------------------------- Haven't been to the website for ages - I must have been relying on your update notices. > Arrange the numbers 1 to 23 in a line so that > each adjacent pair of numbers sums to a square number. 18 7 9 16 20 5 11 14 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 (by hand - didn't check to see if there were other solutions) -- Roger Phillips ---------------------------------------------------------------------- The second one: 18 7 9 16 20 5 11 14 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 -------------------------- Abdullah Görkem Gençay --------------------------------------------------- 18 7 9 16 20 5 11 14 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 This was a fun puzzle…made me really think. J -Reese Lloyd ------------------------------------------------------ a) 6 X 6 board has 18 white & 18 black squares. 15 dominoes cover 15 white & 15 black squares leaving 3 white & 3 black squares for 6 non attacking rooks. In order to not attack each other, 6 rooks stand on either one of the following positions: 6 whites, 4 whites & 2 blacks, 2 whites & 4 blacks, 6 blacks. Therefore, it is impossible. b) 18, 7, 9, 16, 20, 5, 11, 14, 22, 3, 1, 8, 17, 19, 6, 10, 15, 21, 4, 12, 13, 23, 2 cedric Lo ------------------------------------------------------ Hi, I decided to try the problem of "Arrange the numbers 1 to 23 in a line so that each adjacent pair of numbers sums to a square number". I came up with the following: 18,7,2,23,13,12,4,21,15,10,6,19,17,8,1,3,22,14,11,5,20,16,9 I solved it "by hand", first determining that 18 must be at one end of the list. Thanks for the challenge, Scott McCarter --------------------------------------------------------- As for the numbers from 1 to 23 (adjacent numbers summing to a square: 18,7,9,16,20,5,11,14,22,3,1,8,17,19,6,10,15,21,4,12,13,23,2 I go this by starting from the end (18,7) and manually eliminating possibilities (there weren't too many). Nathan Stohler --------------------------------------------------------- Hi, I decided to try the problem of "Arrange the numbers 1 to 23 in a line so that each adjacent pair of numbers sums to a square number". I came up with the following: 18,7,2,23,13,12,4,21,15,10,6,19,17,8,1,3,22,14,11,5,20,16,9 I solved it "by hand", first determining that 18 must be at one end of the list. Thanks for the challenge, Scott McCarter ---------------------------------------------------------- There are three solutions, not counting reflections: 9, 16, 20, 5, 11, 14, 22, 3, 1, 8, 17, 19, 6, 10, 15, 21, 4, 12, 13, 23, 2, 7, 18 2, 23, 13, 12, 4, 21, 15, 10, 6, 19, 17, 8, 1, 3, 22, 14, 11, 5, 20, 16, 9, 7, 18 18, 7, 9, 16, 20, 5, 11, 14, 2, 23, 13, 12, 4, 21, 15, 10, 6, 19, 17, 8, 1, 3, 22 Al Zimmermann ------------------------------------------------------------ There are 6 solutions: 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 14 11 5 20 16 9 7 18 9 16 20 5 11 14 22 3 1 8 17 19 6 10 15 21 4 12 13 23 2 7 18 18 7 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 14 11 5 20 16 9 18 7 9 16 20 5 11 14 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 18 7 9 16 20 5 11 14 22 3 1 8 17 19 6 10 15 21 4 12 13 23 2 22 3 1 8 17 19 6 10 15 21 4 12 13 23 2 14 11 5 20 16 9 7 18 Regards, Igor Krivokon ------------------------------------------------------------- 18-7-9-16-20-5-11-14-2-23-13-12-4-21-15-10-6-19-17-8-1-3-22 You can reverse the chain after 14 for a second answer. Key observation: One end must be 18. Michael Malak Hello! I found quite good 'improvement' for this (by hand): >Arrange the numbers 1 to 23 in a line so that each adjacent pair >of numbers sums to a square number. Send Answer. This had 3 solutions, which are of same family. My last found: 33 13 12 24 25 11 5 3 33 31 18 7 29 20 16 9 27 22 14 2 23 26 10 15 1 8 28 21 4 32 17 19 30 6 I wait really for next results, because I think that's very nice problem. Computers might find something more fun. It's probably possible to find very long hamiltonians too! 2) I found many sols for that 23-problem by hand. Here is one: 18,7,9,16,20, 5,11,14,22,3, 1,8,17,19,6, 10,15,21,4,12, 13,23,2 It's quite amazing that pair 24+25=49 cannot be added. Is that right? Computer-analysis would be easy, because of small tree. Juha ------------------------------------------------------------ =================== Arrange 1 to 23 in a line so that each adjacent pair of numbers sums to a square number: Only the squares 4, 9, 16, 25, and 36 can be used. 18 can only form a square sum with 7 so this appears at one end of the line. A lot of other numbers can only form squares with two other numbers. Only one of these can be at the end of the line, so we know most these sequences will appear, possibly reversed: 2, 23, 13 3, 22, 14 4, 21, 15 5, 20, 16 6, 19, 17 8, 17, 19 9, 16, 20 4, 12, 13 5, 11, 14 6, 10, 15 7, 9, 16 1, 8, 17 Some of these sequences overlap by 2 numbers, and since we can only break one of them to put it on the other end, the internal parts of these are forced. The forced sequences (numbers in parentheses not forced if it goes at the end) are: (5), 20, 16, 9, (7) (6), 19, 17, 8, (1) The other remaining sequences are: 2, 23, 13 3, 22, 14 4, 21, 15 4, 12, 13 5, 11, 14 6, 10, 15 Other numbers can appear next to three or four other numbers: 15 next to 1 10 21 14 next to 2 11 22 13 next to 3 12 23 7 next to 2 9 18 6 next to 3 10 19 5 next to 4 11 20 4 next to 5 12 21 3 next to 1 6 13 22 2 next to 7 14 23 1 next to 3 8 15 There are only two possibilities for 7. It must go next to 18 on one end of the sequence, and the next number must either be 2 or 9. If it is 2, then we must have 9 at the other end of the sequence, and all the other triples besides 7 9 16 above are forced, so we get: 18 7 2 23 13 12 4 21 15 10 6 19 17 8 1 ... on one end, and ... 3 22 14 11 5 20 16 9 on the other. But these two subsequences use up all 23 numbers, and have a valid junction (1+3) in the middle, so this is the whole sequence. If we move 18 and 7 to the other end, we get a second solution: 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 14 11 5 20 16 9 7 18 If we put 9 next to 7, there may be other solutions which must start with 18 7 9 16 20 5 ... 5 can go next to 4 or 11. But it cannot really go next to 4, because to put it there would force both 11 and one of 12 and 21 to go on the other end. So we must begin 18 7 9 16 20 5 11 14 ... If 14 is next to 2, then 22 must go on the other end, and we get the reversal of the rest of the sequence: 18 7 9 16 20 5 11 14 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 Are there still more solutions? If 14 stays next to 22, we must begin: 18 7 9 16 20 5 11 14 22 3 ... 3 can go next to 1, 6, or 13. Both 6 and 13 are next to two other numbers in the semi-forced triples, so whichever goes next to 3 forces one of two other numbers to the other end. However, these sequences force all the numbers but don't match up in the middle: 18 7 9 16 20 5 11 14 22 3 6 19 17 8 1 ... 2 23 13 12 4 21 15 10 18 7 9 16 20 5 11 14 22 3 6 10 15 21 4 12 13 23 2 ... 1 8 17 19 18 7 9 16 20 5 11 14 22 3 13 12 4 21 15 10 6 19 17 8 1 ... 2 23 18 7 9 16 20 5 11 14 22 3 13 23 2 ... 1 8 17 19 6 10 15 21 4 12 So 3 must go next to 1. If 1 went next to 15, both 8 and either 21 or 10 would be forced to the other end (as with 5 not really being able to go next to 4, above). So the sequence must begin: 18 7 9 16 20 5 11 14 22 3 1 8 17 19 6 ... Since 3 is already used, 6 must go next to 10, then 15. Since 1 is already used, 15 must go next to 21, then 4. Since 5 is already used, 12 must come next, then 13. The last two numbers, 23 and 2, are also forced. So we really only have three solutions, and their reversals: 18 7 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 14 11 5 20 16 9 18 7 9 16 20 5 11 14 22 3 1 8 17 19 6 10 15 21 4 12 13 23 2 18 7 9 16 20 5 11 14 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 Joseph DeVincentis ----------------------------------------------------------------- Here are my three solutions: 18-7-9-16-20-5-11-14-22-3-1-8-17-19-6-10-15-21-4-12-13-23-2 18-7-2-23-13-12-4-21-15-10-6-19-17-8-1-3-22-14-11-5-20-16-9 18-7-9-16-20-5-11-14-2-23-13-12-4-21-15-10-6-19-17-8-1-3-22 I assume these need not be a continuous loop (the sum of the first and last being a square) as 18 can only be paired with 7. I formed nine puzzle pieces for my solution, (below,) the end digits of all but the first piece representing those that can pair with three others (in other words, where we have a choice.) 18-7 7-9-16-20-5 5-11-14 14-23-3 1-8-17-19-6 6-10-15 15-21-4 4-12-13 13-23-2 The pieces with the same ends must be connected or form the end of the chain. I am relatively confident that these are the only solutions but would love to see a contradiction Dan Tucker ---------------------------------------------------------------- There are three solutions: (six if you include their reverses) 18,7,9,16,20,5,11,14,2,23,13,12,4,21,15,10,6,19,17,8,1,3,22 18,7,9,16,20,5,11,14,22,3,1,8,17,19,6,10,15,21,4,12,13,23,2 18,7,2,23,13,12,4,21,15,10,6,19,17,8,1,3,22,14,11,5,20,16,9 Proof: We look at the set of numbers that can be adjacent: 1:3,8,15 2:7,14,23 3:1,6,13,22 4:5,12,21 5:4,11,20 6:3,10,19 7:2,9,18 8:1,17 9:7,16 10:6,15 11:5,14 12:4,13 13:3,12,23 14:2,11,22 15:1,10,21 16:9,20 17:8,19 18:7 19:6,17 20:5,16 21:4,15 22:3,14 23:2,13 which is 28 pairs, each counted twice. We need 26 of them to be adjacent, so we need to get rid of 6 pairs, which between them must include 1,2,4,5,6,7,13,14,15 at least once and 3 at least twice. This accounts for 11 of the 12 parts of the 6 pairs. Therefore only 1 pair contains anything we do not know about. Call this pair P. The only neighbour of 7 and the only neighbour of 14 within this set is 2. However we only know that we have to remove one of 2's pairs. Therefore P must contain either 7 or 14. 1,3,4,5,6,13,15 are not neighbours of 4 or 14 and therefore their removed pairs must lie entirely within this subset. 15 and 13 are only adjacent to 1,3 respectively from this set. Therefore we must remove 15,1 and 13,3. We are left to remove pairs from 3,4,5,6, which must be 3,6 and 4,5. The current state is: 1:3,8 2:7,14,23 3:1,22 4:12,21 5:11,20 6:10,19 7:2,9,18 8:1,17 9:7,16 10:6,15 11:5,14 12:4,13 13:12,23 14:2,11,22 15:10,21 16:9,20 17:8,19 18:7 19:6,17 20:5,16 21:4,15 22:3,14 23:2,13 and we are removing 2 pairs, both of which will contain 7 or 14. Therefore any pair not containing 7 or 14 will definitely be adjacent in our row. Furthermore 18 must be on the end and adjacent to 7 Therefore we know the following strings will be in our row: 18,7 22,3,1,8,17,19,6,10,15,21,4,12,13,23,2 9,16,20,15,11 14 If 7 is adjacent to 9, then 11 will not be at the end of the row (as 18 is at one end and 18,7,9,16,20,15,11 does not include enough numbers). Therefore 11 must be adjacent to some other number, and the only remaining candidate is 14. Of the remaining string, both ends can be adjacent to 14, so we get solutions 18,7,9,16,20,15,11,14,2,23,13,12,4,21,15,10,6,19,17,8,1,3,22 18,7,9,16,20,15,11,14,22,3,1,8,17,19,6,10,15,21,4,12,13,23,2 If 7 is not adjacent to 9, then 9 cannot be adjacent to anything other than 16 and must be at the end. Therefore 11 will not be at an end, and must be adjacent to 14 as above. Once again 14 can be adjacent to either of 2 or 22. However the other must be adjacent to 7 and therefore must be 2. Thus we get the final solution 18,7,2,23,13,12,4,21,15,10,6,19,17,8,1,3,22,14,11,15,20,16,9 L T Pebody ------------------------------------------------------------- 2. Arrange the numbers 1 to 23 in a line so that each adjacent pair of numbers sums to a square number. The numbers come out fairly easily when one realises that number 18 has to come at the beginning or at the end of the sequence (since there is only one other number between 1 and 23 that it can be added to to give a perfect square): 18 7 9 16 20 5 11 14 2 23 13 12 4 21 15 10 6 19 17 8 1 3 22 Best wishes, and a happy Thanksgiving! Hugh Rutherford. --------------------------------------------------------------------- I have found three solutions to your problem of arranging the numbers 1 through 23 in a row so that all pairs of adjacent numbers sum to perfect squares. I believe these are all of them, though I can't prove it. Solution 1: 18-7-2-23-13-12-4-21-15-10-6-19-17-8-1-3-22-14-11-5-20-16-9. Solution 2: 18-7-9-16-20-5-11-14-22-3-1-8-17-19-6-10-15-21-4-12-13-23-2. Solution 3: 18-7-9-16-20-5-11-14-2-23-13-12-4-21-15-10-6-19-17-8-1-3-22. Darrel C Jones ------------------------------------------------------------- 6 different solutions, thanks to symmetries. 2, 23, 13, 12, 4, 21, 15, 10, 6, 19, 17, 8, 1, 3, 22, 14, 11, 5, 20, 16, 9, 7, 18 9, 16, 20, 5, 11, 14, 22, 3, 1, 8, 17, 19, 6, 10, 15, 21, 4, 12, 13, 23, 2, 7, 18 18, 7, 2, 23, 13, 12, 4, 21, 15, 10, 6, 19, 17, 8, 1, 3, 22, 14, 11, 5, 20, 16, 9 18, 7, 9, 16, 20, 5, 11, 14, 2, 23, 13, 12, 4, 21, 15, 10, 6, 19, 17, 8, 1, 3, 22 18, 7, 9, 16, 20, 5, 11, 14, 22, 3, 1, 8, 17, 19, 6, 10, 15, 21, 4, 12, 13, 23, 2 22, 3, 1, 8, 17, 19, 6, 10, 15, 21, 4, 12, 13, 23, 2, 14, 11, 5, 20, 16, 9, 7, 18 bill clagett P.S. I cheated: #!/usr/local/bin/ruby class Integer def square? sr = Math.sqrt(self).floor sr * sr == self end end def solve arranged, unused if unused.empty? puts arranged.join ', ' else unused.each do |n| if arranged.empty? || (n + arranged.last).square? solve arranged + [n], unused - [n] end end end end solve [], (1..23).to_a --------------------------------------------------- Arrange the numbers 1 to 23 in a line so that each adjacent pair of numbers sums to a square number. Answer:18 7 9 16 20 5 11 14 22 3 1 8 17 19 6 10 15 21 4 12 13 23 2 This was a very interesting puzzle. Koi Morris ---------------------------------------------------- Ed -- Here's a solution to the problem of lining up the integers 1 to 23 so that adjacent integers add up to a perfect square: 18, 7, 2, 23, 13, 12, 4, 21, 15, 10, 6, 19, 17, 8, 1, 3, 22, 14, 11, 5, 20, 16, 9 Another is formed by taking the last 21 integers of that sequence and reversing them: 18, 7, 9, 16, 20, 5, 11, 14, 22, 3, 1, 8, 17, 19, 6, 10, 15, 21, 4, 12, 13, 23, 2 Or, take the last 15 integers of this new sequence and reverse them: 18, 7, 9, 16, 20, 5, 11, 14, 2, 23, 13, 12, 4, 21, 15, 10, 6, 19, 17, 8, 1, 3, 22 There appear to be the only solutions (except reversals of the entire sequence); I found them by drawing the graph (attached) whose nodes are the integers from 1 to 23, and that has an edge connecting every pair of integers that adds to a perfect square. You can then find the solutions by looking for Hamiltonian paths in this graph... -- Alex Ridgway Metuchen, NJ ----------------------------------------------------- The solution (unique except for reversal) is: 18-7-9-16-20-5-11-14-22-3-1-8-17-19-6-10-15-21-4-12-13-23-2 With adjacent sums: 25-16-25-36-25-16-25-36-25-4-9-25-36-25-16-25-36-25-16-25-36-25 The prevalence of 25 isn't too surprising, since many of the numbers are around 25/2 -- a large portion of numbers can only make two squares, with 25 being one of them. Proof of uniqueness is pretty straightforward; I just drew an adjacency matrix, collapsed the chains of nodes with only two adjacencies (and treated those as edges that must follow) and then looked at the resulting graph. 18 has to either start or end the chain (its only adjacency is with 7), and then there are two 'must-follow' paths -- one that runs 18-7-5-14-3 and one that runs 1-6-15-4-13-2. The only place they can link into a single path is via the 1-3 connection. Steven Stadnicki ----------------------------------------------------------- David Friedman also sent a solution