# A Circle of numbers

Just saw a Circle of numbers on my Whats App message (source not listed) which is as following

Arrange numbers 1 to 32 in a circle such that any two adjacent (neighboring) numbers add up to a perfect square (like 1,4,9,16 etc). No number can be repeated.

Without programing you can try that and get an answer.

There is a question on this site

Fourteen numbers around a circle

That puts 14 numbers around a circle where either the sum or the absolute difference between the neigboring numbers is a Prime number

Here is my question

Can you put numbers 1 to 32 (without repeating any number) in a circle such that the sum of the neighboring numbers is a Prime Number?

So if any three numbers (clockwise or anti clockwise) are a,b and c then a+b and b+c must be a Prime. and so on.

You can either answer my question OR both the WhatsApp and my question together.

There may be more than one answer.

Here is one way to do it

Clockwise ordered (or anti-clockwise ordered, if you prefer)
32, 11, 30, 13, 28, 15, 26, 17, 24, 19, 22, 21, 20, 23, 18, 25, 16, 27, 14, 29, 12, 31, 10, 1, 2, 3, 4, 7, 6, 5, 8, 9

Strategy

I focused on a set of twin primes and saw that I could start with a large even number and a small odd number and decrease the even number by 2 each alternate step while increasing the alternate odd number.
Starting with the large even number at 32, this would allow me to catch every number greater than or equal to the small odd number.
{41, 43} is the first twin prime pair above 32, so I started with this, making the first small odd number equal to 11 and so it catches every number above 11.
Then I just had to arrange the remaining numbers below 11 in a appropriate manner which wasn't too difficult on its own.

• As long as the math checks out, I'm pretty sure the "anticlockwise ordered" version should work too :-)
– Bass
Jan 8, 2021 at 16:08
• @Bass haha, yes, that is a good point actually. Jan 8, 2021 at 16:10
• See you had the same base idea.. Jan 8, 2021 at 17:24

EDIT: This answer is wrong, I misunderstood the question

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

Method:

I realized that all the odd numbers (and all the even numbers) can be easily arranged such that the difference is always two. So I wrote two sequences 32, 30, 28... 6, 4, 2 and 1, 3, 5, 7... 25, 27, 29. Then I joined them removing 3,1 and 31 and placed them in three positions that fit. These positions were find by trial and errors.

• I think you misunderstand. 32+30 , must add up to a Prime for example.
– DrD
Jan 8, 2021 at 15:25
• so of the numbers are a b c d e f g etc then a+b b+c c+d d+e e+f f+g etc must be Prime numbers
– DrD
Jan 8, 2021 at 15:26
• @drd Sorry I though the difference must be a prime numbe Jan 8, 2021 at 15:26
• No issues. I think there could be several answers but I only got 1 without programming
– DrD
Jan 8, 2021 at 15:29

My strategy

Start with a twin prime close to 33 : 29,31
Create the longest sequence with those, add the remaining numbers
1 28 3 26 5 24 7 22 9 20 11 18 13 16 15 14 17 12 19 10 21 8 23 6 25 4 27 2 29 30 31 32 Only 32 causes problems see where it can be swapped: with 20, 10 and 4
Of those 10 fits between 31 and 1 for the answer:
1 28 3 26 5 24 7 22 9 20 11 18 13 16 15 14 17 12 19 32 21 8 23 6 25 4 27 2 29 30 31 10