# Rules

You are given a square grid, with numbers (0-9) in some of its cells. You have to connect some of the numbers, so that each "island" of numbers has the same total sum. A number can have anywhere from 0 to 4 connections that go straight up, down, left or right. Two connections may never intersect.

Some notes:

• You can't just connect all numbers together, you must have at least 2 "islands" of numbers.
• The only place a T-intersection may happen is at a number, not in an empty cell.

# Solved examples

Here the sum of every group is 3 (note that the lonely 3 is still a valid group)

 1-----1  1
| 3      |
1     2--0


Alternate solution

 1-----1--1
3
1-----2--0


A bigger example

 1--0--3     5
|  |        |
|  2-----4  |
|           |
8     7-----6


# Problem

Here are a few textual versions of the image.

Compressed:

2    00
3  02  3
0 140
4  3 4
023
01 25
3  1 22
46     3


 2              0  0

3        0  2        3

0     1  4  0

4        3     4

0  2  3

0  1     2  5

3        1     2  2

4  6                 3


EDIT: Ok, It seems to be quite easy, right? Now here is a harder challenge: Can you split it into a maximal number of "islands"? (Thanks to @ghosts_in_the_code for this addition)

• I suggest modifying the question to ask for maximum possible islands. Oct 22, 2015 at 16:14
• @ghosts_in_the_code Thanks, done (somewhat). Oct 22, 2015 at 17:00

Once you realize that a number needs to be at each corner (e.g. no intersections in a blank square), then the difficulty crops up.

So, here is a solution with 6 islands.

I think this is the largest count of islands you can get. I thought at first that it could be 10, but with the 4 locked in the lower left, then the lowest value would be 7, which is not a factor of 60 (the total value of numbers in the puzzle). With the way the puzzle is set up, your lowest factor would be 10.

• I would accept it as this is almost my solution, but if somebody comes with more islands, I would have to accept his/hers instead. Oct 22, 2015 at 17:05
• No problem. I think there might be multiple solutions for a 6 island layout, but as I said, that 4 and 3 in the bottom left seem to make 6 the highest number of islands you can have. What I would like to see are 3, 4, and 5 island solutions as well... Oct 22, 2015 at 17:07
• In my opinion you should've connected the two lonely 0s to the existing islands because they are technically two seperate islands with sum 0. Oct 22, 2015 at 21:45

A quick argument that APrough's solution with 6 islands (each with sum 10) already maximizes the number of islands:

• The sum of all numbers is 60. Hence the only possibilities for $x$ islands each with sum $y$ are the following twelve pairs $(x,y)$: $~~(1,60)$, $~(2,30)$, $~(3,20)$ , $~(4,15)$, $~(5,12)$, $~(6,10)$, $~(10,6)$, $~(12,5)$, $~(15,4)$, $~(20,3)$, $~(30,2)$, and $~(60,1)$.
• The first pair has $x=1$, and a single island is forbidden by the rules.
• The number $6$ (in row $8$, column $2$) enforces $y\ge6$.
• This leaves us with the six pairs $~(2,30)$, $~(3,20)$ , $~(4,15)$, $~(5,12)$, $~(6,10)$, $~(10,6)$.
• Also $(x,y)=(10,6)$ is impossible: In this case, the entry $4$ in the lower left corner can neither be connected to its right neighbor $6$ (as the sum of the resulting island would exceed $6$), not can it be connected to its upper neighbor $3$ (as the sum be violated again), nor can it stay alone.
• Nice, that's what I was waiting for... Oct 22, 2015 at 17:22
• It would be nice to know whether the other three potentially possible solutions (3,20), (4,15), (5,12) can indeed be implemented. In fact, (3,20) can be implemented by merging the six islands in APrough's solution into three islands. Oct 22, 2015 at 17:31
• There exists a 5 island solution as well. However, the 4 island solution is not possible. Oct 22, 2015 at 17:58
    2--------------0--0
|
3---------0--2--------3
|  |
0-----1  4--0
|           |
|  4--------3-----4
|  |              |
|  0  2--3        |
|     |           |
0  1     2--5        |
|        |           |
3--------1-----2--2  |
|                    |
4--6                 3


A simple 2 island solution.

The puzzle is way too easy.

Keep the first five rows in Group A, and the last three in Group B. Transfer the '1' at row 6 col 2 to Group A, and the '2' at row 5 col 4 to Group B. Connections within the group is very easy. Now we have 2 groups that add up to $30$ each.

• Doesn't work (altough something very similar does), you have crossing lines (if i'm mistaken, please copy my solution and use it draw in your lines) Oct 22, 2015 at 16:45
• Yeah, seems like you can't connect both the 4 at {4:2} (row:col) and the 3 at {5:4} Oct 22, 2015 at 17:12

Initial question and examples didn't make it clear whether existing islands could be split up, so keeping existing islands together I came up with this.

Here we go: