The Mystic Circle

Logic Level 3

Arrange the numbers 1 32 1 - 32 , inclusive, in a circle such that the sum of any two adjacent numbers in the circular chain is a perfect square .

When you crack the Mystic Circle, you will obtain 32 32 Square numbers which are the sums of adjacent numbers.

If the number of times the squares 4 , 9 , 16 , 25 , 36 , 49 4, 9, 16, 25, 36, 49 appear is given by A . B , C , D , E , F A. B, C, D, E, F respectively, find 1 A + 2 B + 3 C + 4 D + 5 E + 6 F 1A + 2B + 3C + 4D + 5E + 6F .


The answer is 148.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

6 solutions

Satyen Nabar
Jul 2, 2015

The compulsory links -

4 32 17 4-32-17

5 31 18 5-31-18

6 30 19 6-30-19

7 29 20 7-29-20

8 28 21 8-28-21

9 27 22 9-27-22

10 26 23 10-26-23

11 25 24 11-25-24

Now 18 18 can only be linked with 7 7 , So we have 5 31 18 7 29 20 5-31-18-7-29-20 . And 20 20 can only be paired with 16 16 which can only be paired with 9 9 so we have 5 31 18 7 29 20 16 9 27 22 5-31-18-7-29-20-16-9-27-22

And 19 19 can only be paired with with 17 17 so we have 4 32 17 19 30 6 4-32-17-19-30-6

Beyond this point is case work along with logic.

5 5 can be paired with either 4 4 or 11 11 .

22 22 can be paired with 3 3 or 14 14

4 4 can be paired with 5 5 , 12 12 , or 21 21 .

6 6 can be paired with 3 3 or 10 10 .

Trying out all options, leads to the one unique solution above.

The number of times the squares 4 , 9 , 16 , 25 , 36 , 49 4, 9, 16, 25, 36, 49 appear are 0 , 2 , 4 , 6 , 12 , 8 0, 2, 4, 6, 12, 8 respectively. The answer is 0 + 4 + 12 + 24 + 60 + 48 = 148 0 + 4 +12 + 24 + 60 +48 =148 .

Nice problem! Thanks for sharing!

Swapnil Das - 5 years, 11 months ago

Log in to reply

Tx Swapnil. Congrats on solving it...

Satyen Nabar - 5 years, 11 months ago

Log in to reply

Haha, thank you!

Swapnil Das - 5 years, 11 months ago

I worked on this for a couple of hours (don't know how to write a program for this), but I loved it. I wrote it all down in a table in Word, the ancient way 😁

Mauritz VD - 1 year, 7 months ago
Ferren Alwie
Jul 11, 2015

Love this problem! Thank you for sharing! :)

Tx Ferren. Glad u enjoyed it!

Satyen Nabar - 5 years, 11 months ago
Abdelhamid Saadi
Jul 10, 2015

I propose a solution in python 3.4:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def possibleneighbours(n):
    res=[]
    for i in range(2,8):
        m = i*i - n
        if m > 0 and m <= 32 and m != n:
            res.append(m)
    return res

allsolutions = []

def browse(mypath):
    global allsolutions
    currentnode = mypath[-1]
    neighbours = possibleneighbours(currentnode)
    if len(mypath)== 32 and mypath[0] in neighbours:
        allsolutions.append(list(mypath))
    disp = list(set(neighbours) - set(mypath))
    for nextnode in disp:
        mypath.append(nextnode)
        browse(mypath)
        mypath.pop()


def computeresult():
    global allsolutions
    allsolutions = []
    browse([32])
    path = allsolutions[0]
    tot = 0
    for i in range(32):
        j = (i + 1)%32
        tot += ((path[i] +  path[j])**.5) -1
    return tot  

computeresult()

And of course this seems to have only one solution - just like any other problem on Brilliant (that I have seen).

Dejan Tomić - 5 years, 4 months ago

Log in to reply

This is a Mystic assumption.

Abdelhamid Saadi - 5 years, 4 months ago

Is this the smallest circle to have such a mystic circle? What is the next largest?

Officially to get the correct solution, you don't need to "solve" the mystic circle itself (assuming that you know there is a solution).

The sum of all the squares is 2 * (1 + 2 + 3... + 32), or 32 * 33, or 1056, as each number from 1 to 32 is used once

All that is needed then is to find a totally positive whole number solution to the two simultaneous equations a + b + c + d + e + f = 32 4a +9b +16c +25d +36e + 49f = 1056

By observation, you can see that the value of f has to be 8 (and that the value for e has to be at least 9, and that the value for a cannot be greater than 1), which helps to narrow down the search some more.

Charles Gaskell - 2 years, 11 months ago

Log in to reply

Why does f has to be 8?

Pieter van Veelen - 2 years, 8 months ago

I think this is the smallest Mystic Circle , altough I don't have the time/will to try and derive a formal proof, but I am pretty confident about this being true. I also think that the next smallest Mystic Circle could be the one formed by the first 50 50 non-negative integers (so all the natural numbers ranging from 1 1 up to 50 50 ), but in this case the compulsory chains to begin with would be just two :

( 15 , 50 , 31 ) , ( 16 , 49 , 32 ) , (15,50,31),\quad(16,49,32),

which would implie the conditions:

H 2 , G 2. H\geq2,\quad G\geq2.

This means we would be left with 44 44 lonely numbers to deal with, and also the structural equation would be:

4 A + 9 B + 16 C + 25 D + 36 E + 49 F + 64 G + 81 H = 2 n = 1 50 n = 2550 , 4A+9B+16C+25D+36E+49F+64G+81H=2\sum_{n=1}^{50}n=2550,

along with the condition:

A + B + C + D + E + F + G + H = 50 , A+B+C+D+E+F+G+H=50,

and combining the two we could eliminate just the first variable, A A , obtaining:

5 B + 12 C + 21 D + 32 E + 45 F + 60 G + 77 H = 2350 , 5B+12C+21D+32E+45F+60G+77H=2350,

which could be narrowed a little bit by applying the conditions on H H and G G .

I think this equation would be too hard to solve by just "guessing and checking" by hand, without coding a program that would do it in a faster way, but essentialy just applying the typical brute force method.

Maybe someone with good Phyton programming skills, like @Abdelhamid Saadi, could work it out.

Michele Polli - 1 year, 10 months ago
Michele Polli
Jul 25, 2019

Because there are eight compulsory chains formed by three numbers each to begin with , in which the central number decreases from 32 32 to 25 25 (leaving exactly the eight lonely numbers 1 , 2 , 3 , 12 , 13 , 14 , 15 , 16 1,2,3,12,13,14,15,16 ), and each of these chains has two numbers that sum up to 49 49 and two numbers that sum up to 36 36 , we have, right at the beginning, the following conditions:

F 8 , E 8. F\geq8,\quad E\geq8.

But it is impossible to obtain another 49 49 by adding two numbers from different chains or by adding a tip number of any chain and any lonely number . Therefore, F = 8 F=8 .

But we can also observe that because of the compulsory links ( 17 19 ) , ( 18 7 ) , ( 20 16 9 ) , ( 1 8 ) , ( 15 10 ) , ( 23 2 14 ) (17-19),\space(18-7),\space(20-16-9),\space(1-8),\space(15-10),\space(23-2-14) and ( 3 13 12 ) (3-13-12) , there are six compulsory chains to begin with, which are:

( 4 32 17 19 30 6 ) ( 5 31 18 7 29 20 16 9 27 22 ) ( 1 8 28 21 ) ( 15 10 26 23 2 14 ) ( 3 13 12 ) ( 21 25 24 ) \begin{aligned} & (4-32-17-19-30-6) \\ & (5-31-18-7-29-20-16-9-27-22) \\ & (1-8-28-21) \\ & (15-10-26-23-2-14) \\ & (3-13-12) \\ & (21-25-24) \end{aligned}

This means we have exactly one 9 9 , two 16 16 , five 25 25 and two 36 36 more, so, even before starting the "guess and check", we have the following conditions:

F = 8 , E 10 D 5 , C 2 , B 1. F=8,\quad E\geq10\,\quad D\geq5,\quad C\geq2,\quad B\geq1.

Therefore, we can simplify the structural equation of the Mystic Circle from

4 A + 9 B + 16 C + 25 D + 36 E + 49 F = 2 n = 1 32 n = 1056 4A+9B+16C+25D+36E+49F=2\sum_{n=1}^{32}n=1056

to

4 A + 9 β + 16 γ + 25 δ + 36 ε = 1056 8 × 49 10 × 36 5 × 25 2 × 16 1 × 9 = 138 4A+9\beta+16\gamma+25\delta+36\varepsilon=1056-8\times49-10\times36-5\times25-2\times16-1\times9=138

where B = 1 + β , C = 2 + γ , D = 5 + δ , E = 10 + ε B=1+\beta,\space C=2+\gamma,\space D=5+\delta,\space E=10+\varepsilon and A + β + γ + δ + ε = 6 A+\beta+\gamma+\delta+\varepsilon=6 .

From the last condition, because we are adding five non-negative integers to make a six , by the pigeonhole principle we know that at least one of these integers must be at least equal to two .

At this point, note that A 2 A\leq2 , because if A = 3 A=3 , for example, even a value of ε = 3 \varepsilon=3 wouldn't be enough for the total to be 138 138 , because 3 × 4 + 3 × 36 = 120 < 138 3\times4+3\times36=120<138 .

Because 138 0 ( m o d 23 ) 138\equiv0\pmod{23} , applying some modulo- 23 23 arithmetic to the remainders 4 , 9 , 16 , 2 , 13 4,9,16,2,13 of the squares 4 , 9 , 16 , 25 , 36 4,9,16,25,36 when divided by 23 23 , it can be shown that A < 2 A<2 , because the only solution with A = 2 A=2 , which is A = 2 , γ = 3 , ε = 1 A=2,\gamma=3,\varepsilon=1 , is not valid since 2 × 4 + 3 × 16 + 1 × 36 = 92 138 2\times4+3\times16+1\times36=92\neq138 .

By the same logic, it can be shown that A 1 A\neq1 , because the only solution with A = 1 A=1 , which is A = 1 , ε = 5 A=1,\varepsilon=5 , is not valid since 1 × 4 + 5 × 36 = 184 138 1\times4+5\times36=184\neq138 . Therefore, A = 0 A=0 .

Knowing this, and applying the same modulo- 23 23 arithmetic, it can be shown that the only valid solution is β = 1 , γ = 2 , δ = 1 , ε = 2 \beta=1,\gamma=2,\delta=1,\varepsilon=2 , which corresponds to

A = 0 , B = 2 , C = 4 , D = 6 , E = 12 , F = 8 A=0,B=2,C=4,D=6,E=12,F=8

and yields the correct answer:

1 × 0 + 2 × 2 + 3 × 4 + 4 × 6 + 5 × 12 + 6 × 8 = 148 . 1\times0+2\times2+3\times4+4\times6+5\times12+6\times8=\boxed{148}.

Therefore, the solution of the Mystic Circle is unique.

Eric Holt-Leclerc
Jul 17, 2020

Python solution:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
NUMBERS = range(1, 33)
SQUARES = (4, 9, 16, 25, 36, 49)

def main():
    streak = []
    nums = list(NUMBERS)
    n = nums.pop(0)
    streak.append(n)
    success = recurse_add(n, nums, streak)

    if success:
        print '******\nStreak\n******'
        print streak

    squares = [(streak[i] + streak[i-1]) for i in range(0, len(streak))]
    print '******\nSquares\n******'
    print squares

    sq_count = []
    for s in SQUARES:
        sq_count.append(squares.count(s))
    print '******\nSquare count\n******'
    print sq_count

    answer = 0
    for m in range(1, 7):
        answer += m*sq_count[m-1]

    print '******\nAnswer\n******'
    print answer

def recurse_add(n, nums, streak):
    if not nums:
        return (streak[0] + streak[-1]) in SQUARES
    added = False
    for i in range(0, len(SQUARES)):
        a = SQUARES[i] - n
        if a < 1:
            continue
        if a in nums:
            nums.remove(a)
            streak.append(a)
            added = recurse_add(a, nums, streak)
            if not added:
                streak.remove(a)
                nums.append(a)
    return added 

Output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
******
Streak
******
[1, 8, 28, 21, 4, 32, 17, 19, 30, 6, 3, 13, 12, 24, 25, 11, 5, 31, 18, 7, 29, 20, 16, 9, 27, 22, 14, 2, 23, 26, 10, 15]
******
Squares
******
[16, 9, 36, 49, 25, 36, 49, 36, 49, 36, 9, 16, 25, 36, 49, 36, 16, 36, 49, 25, 36, 49, 36, 25, 36, 49, 36, 16, 25, 49, 36, 25]
******
Square count
******
[0, 2, 4, 6, 12, 8]
******
Answer
******
148 

Andre Engels
Nov 2, 2018

Going with compulsory pairs (numbers that could only form squares in two ways, either directly or after some numbers had been eliminated) I got to part rings 1-8-28-21 + 5-31-18-7-29-20-16-9-27-22 + 6-30-19-17-32-4 + 10-26-23-2-14 + 11-25-24 + 3-13-12. At this point I was stuck a bit, but 15 gave me the next step: It can be coupled with 1, 10 and 21, but 1 and 21 are at 2 ends of the same part ring, so we cannot couple it with both of these, which means it must be coupled with 10. After this, the numbers all fell into 3 part-rings, from which the full ring was easily created.

1 pending report

Vote up reports you agree with

×

Problem Loading...

Note Loading...

Set Loading...