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

Home > Numbers
Square pairs (Posted on 2005-01-09) Difficulty: 3 of 5
Back in An Arrangement of 15 you were asked to place the numbers 1 to 15 in a line so that any two adjacent numbers summed to a square number.

Now, try to arrange the numbers from 1 to 32 in a circle, so any two adjacent numbers again sum a square number.

See The Solution Submitted by e.g.    
Rating: 4.3333 (12 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer Solution--Spoiler | Comment 3 of 12 |

The numbers, and the total of each number with the number before:

 1  9
15 16
10 25
26 36
23 49
 2 25
14 16
22 36
27 49
 9 36
16 25
20 36
29 49
 7 36
18 25
31 49
 5 36
11 16
25 36
24 49
12 36
13 25
 3 16
 6  9
30 36
19 49
17 36
32 49
 4 36
21 25
28 49
 8 36

This is one of two found by the following program.  The other is just the reverse of this one.

DECLARE SUB addOn (p!)
CLEAR , , 5000
DIM SHARED posn(32), used(32)
CLS

posn(1) = 1: used(1) = 1

addOn 2


SUB addOn (p)
 FOR i = 2 TO 32
  IF used(i) = 0 THEN
    t = posn(p - 1) + i
    sqroot = INT(SQR(t) + .5)
    IF sqroot * sqroot = t THEN
     posn(p) = i
     IF p = 32 THEN
      t = posn(1) + posn(32)
      sqroot = INT(SQR(t) + .5)
      IF sqroot * sqroot = t THEN
        FOR j = 1 TO 32
         IF j = 1 THEN k = 32:  ELSE k = j - 1
         PRINT USING "###"; posn(j); posn(j) + posn(k)
        NEXT
        PRINT
      END IF
     ELSE
      used(i) = 1
      addOn p + 1
      used(i) = 0
     END IF
    END IF
  END IF
 NEXT
END SUB

 


  Posted by Charlie on 2005-01-09 19:25:52
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


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

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information