# More stepping stones

Start by placing prime numbers 2, 3 and 5 anywhere on an infinite square grid. Now you can place a prime number $$p$$ subject to the following rules:

• It must be greater than all the previous numbers placed.
• The sum of its 8 neighbours must be equal to $$p$$.

What is the largest prime that you can place?

• You mean we can keep placing a prime $p$ as long as it satisfies the condition? Mar 29, 2022 at 13:21
• yes as long as it satisfies both conditions. Don't worry they don't get very high and this can be done by hand. Mar 29, 2022 at 13:26

From the starting 2, 3, 5, the only prime we can make is 7 (5+2). So 2 and 5 must surround 7 in the configuration after placing 7, with 3 not touching 7.

After this, to get a prime larger than 7, we must include 7. Any combinations with only 2 and 5 are not primes (9, 12, 14), so 3 must be involved. And it's only possible with 2+3+5+7 = 17. So 17 must be surrounded by the other 4 numbers.

So now we have something like this (and any rotations thereof):

  A          B
X  7 X    7  X Y
X 17 X or X 17 Y
Y  Y Y    Y  Y Y


Where X is a possible location for 2 and 5, and Y is a possible location for 3. Let's call the left configuration as A, the right one B.

The next few primes larger than 17 but less than the sum of all numbers so far (34) are: 19, 23, 29, 31.

### Case 1: 19

It's only possible with 2+17. In configuration A, this means it must be one of the corner Y's below, with 2 directly above it, 3 on the next corner, and 5 at either of the other X's. WLOG, 19 at the bottom left. So we have:

 X  7 X
2 17 X
19  . 3


To form the next prime, since it must be odd, it must touch odd number of previous numbers except 2. 19+2=21 is not a prime, so we can't expand left. If we involve 19, we can only put 41 at the bottom center. 19+41+3=63 is not a prime, so we can't expand downward, and must expand rightward. By placing 5 at top right, we get 5+7+17+41+3=73, a prime. Unfortunately 73+5+3=81 is not prime. So we stop here, with highest number 73:

 .  7  5
2 17 73
19 41  3


If we don't include 19, then the only prime is 7+17+5=29 on the top right. Then the next primes are forced, to arrive at:

      107
7  29 71
2 17   5 37
19      3


And since 107+7+29=143=13x11 and 107+29+71=207=3x69, we are done here.

In configuration B, WLOG 2 on the center left. Similar to previously, to get an odd number, the next one should touch 1 or 3 odd numbers (impossible to touch 5 at this point). For 1 odd number, we get the failed 19+2, and for 3 odd numbers, we get it must be 2+17+19+3 as previous (can't touch 5 without also touching 3, and 17 will always be touched).

 7  5 .
2 17 Y
19 41 Y


They only way to touch odd numbers of numbers would be to have it touch 3 numbers 41+17+3=61 at the bottom right. Then 19+41+61=121 is not prime and we are done. The highest here is 61.

### Case 2: 23

It's not possible to get 23 from any sum of 2, 3, 5, 7, 17.

### Case 3: 29

It must be 2+7+17+3=29 or 5+7+17=29. In configuration A, in the first sum since it must touch 7 and 3, it must be on the middle row. WLOG, it's on the left column. On the second sum, we have some freedom. Then we have:

   C           D          E
2  7 X     5  7 X    29  7 X
29 17 X or 29 17 X or  5 17 X
Y  Y .     .  . 3     Y  Y Y


In configuration C, again, to touch 3 odd numbers would be either not including 29 (same as Case 1, no prime, or 29, which already exists) or including 29. With including 29, we have 29+17+3=49, not a prime, or 2+29=31 on the left. Then 31+2=33 is not prime, and the next possible touching 3 odd numbers would be 31+2+29+3=65 not a prime. So maximum here is 31.

In configuration D, there is no more place to put a larger prime (29+17+3=49 29+17+3+2=51 both not prime).

Configuration E is already covered in Case 1, since 3 must be involved next (otherwise there won't be enough odd numbers).

In configuration B, it's not possible to touch 7.

### Case 4: 31

The only way to form 31 is 2+5+7+17. Not possible in any configuration.

### Final result

So maximum prime number we can place is 107 in case 1, like so:

      107
7  29 71
2 17   5 37
19      3

• Great work. I will say that there is a better answer as you made a wrong statement somewhere. Mar 29, 2022 at 14:31
• Hmm, any hints? I fixed one missing case, but still haven't got better answer. Mar 29, 2022 at 14:44
• This statement is false "So 19 must be included" Mar 29, 2022 at 14:55
• That actually showed I missed two cases, which happen to lead to the solution 🤦🏻‍♂️ Mar 29, 2022 at 15:04
• I wonder which variant of this question enable us to keep going top right until it stops somewhere longer than mere 107. Maybe with different starting condition and different criteria for the numbers. Anyway, good puzzle, as usual! Mar 29, 2022 at 15:13