Please read part 1 or this might be confusing

Since part 1, you have replaced the stolen stickers and your daughter has forgiven you. The highway ended up being a full 700km long, so you are happy that you were able to place your last sign far enough out such that the entire highway was to code.

But suddenly... you receive a new job:

The city of Savage now has a second highway leading out from the city center. This highway goes for some distance until it reaches the city of Hogan. You must place distance markers along this highway but they now must be double-sided. Each sign must read the distance to Hogan on one side, and the distance to Savage on the other.

Your sign-printing machine is still down. With a tear in your eye, you walk into your daughter's room and pull the new pack of stickers from her tiny, trembling, hands. You say nothing as you step backwards through the door, and then turn and head off to the factory. You have a job to do.

What is the maximum distance between the city of Savage and the city of Hogan for which you could place double-sided distance marker signs and still satisfy highway code?

Other than signs being double-sided, it's basically the same requirements as last time. 10 of each digit. Signs are at most 20km apart. Leading zeros not required. No lateral-thinking. Computer algorithms are cool (probably necessary for the best answer). Remember the answer is the total distance and not the biggest number on a sign (that should be a different number). Each sign, if you added the front and back together, should be the exact distance between the cities.

Like last time, I'm sure my answer isn't optimal.

Bonus question for the more hardcore computer people: What is the minimum distance where you cannot satisfy highway code?

That's a bonus question because I have no idea. I think it will be less than the other answer. That would be cool.

  • $\begingroup$ biggest number isnt the same thing with total distance? $\endgroup$ – Oray Jun 11 '19 at 15:49
  • 1
    $\begingroup$ The city of Hogan could lie a full 20km beyond your last sign, so the biggest number on a sign wouldn't be the answer. The two sides of a sign added together should be the answer though. That's the total distance. $\endgroup$ – Dark Thunder Jun 11 '19 at 15:51
  • $\begingroup$ wouldnt be reasonable to use 6 as 9 or other way around? :D $\endgroup$ – Oray Jun 12 '19 at 16:03

Here is my answer:

9 (227), 29 (207), 49 (187), 69 (167), 89 (147), 109 (127), 129 (107), 149 (87), 169 (67), 188 (48), 208 (28), 228 (8)

so my max is


  • $\begingroup$ Laughs out loud! $\endgroup$ – Weather Vane Jun 11 '19 at 18:26
  • $\begingroup$ @WeatherVane just beat you! :) $\endgroup$ – Oray Jun 11 '19 at 18:27
  • $\begingroup$ I'm still running one... $\endgroup$ – Weather Vane Jun 11 '19 at 18:28
  • $\begingroup$ @WeatherVane this is optimal :) did checked every possibility. $\endgroup$ – Oray Jun 11 '19 at 18:29
  • 1
    $\begingroup$ I had literally just realised there were enough 8s left to make it work. I would be surprised if this new answer is not the maximum. $\endgroup$ – hexomino Jun 12 '19 at 15:53

I have managed to get better than the existing answers for a maximum distance from Savage to Hogan of

234 km

With the following sign choice

9(225), 29(205), 49(185), 69(165), 89(145), 109(125), 129(105), 149(85), 169(65), 189(45), 207(27), 227(7)

I think the actual maximum is within 10 of this as I've been forced to use all the 1s and 2s at this point.

  • 1
    $\begingroup$ Haha! I very nearly made that 2nd edit for you. $\endgroup$ – Dark Thunder Jun 12 '19 at 15:44
  • $\begingroup$ @DarkThunder Haha, yeah, Oray has now slightly modified the method above to get 2km better. I can't see how this could be topped. $\endgroup$ – hexomino Jun 12 '19 at 15:55
  • $\begingroup$ It was killing me not to hint that you were so close. You aren't exactly hurting for reputation, but arguably you deserve a big chunk of the credit. I didn't know when I asked this question that there was such a big gap between distances that worked... it's unintentionally awesome. $\endgroup$ – Dark Thunder Jun 12 '19 at 16:07
  • $\begingroup$ @DarkThunder Yeah, true. The question about the minimum is interesting, that is still unresolved I take it? $\endgroup$ – hexomino Jun 12 '19 at 16:09
  • 1
    $\begingroup$ @WeatherVane suggested 209. I tried my hand at solving 209 and it does seem impossible. If true, that's a far greater difference than I would have imagined. Reminds me of the theory of the "island of instability" in regards to the periodic table. $\endgroup$ – Dark Thunder Jun 12 '19 at 16:13

I severely underestimated the effort required to find a solution by brute force, but the best I have found until now, and I don't think that my search will find anything better, is the following solution:

203 km with signs reading 20/183, 40/163, 60/143, 79/124, 94/109, 109/94, 129/74, 149/54, 168/35 and 183/20.

Intuitively, I would have thought that a longer distance should be possible, but using a little brain and not just brute force, I believe it can be shown that this is not too far from a proven maximum:

First of all, we need all of the 1-digits for signs reading '1xx km' to reach beyond 200 km, e.g. 109, 129, 149, 169 and 189 (five signs with the digit 1 in each direction makes a total of 10 times) would get us to 209 km. This means that we can't use 1 as a tens digit and therefore will need signs reading '2x km' and '12x km' and if we continue beyond 200km with signs reading '20x km' and '22x km', we have used up all the 2-digits as well. I am not quite sure about the last digit, but even if a sign reading '229 km' could be achieved, the cities can't be further apart than 249 km.


So far I have the maximum distance from Savage to Hogan

208 km

But for some reason I can only use about half (54) of the numbers available
20/188 40/168 60/148 80/128 99/109 109/99 129/79 148/60 168/40 186/22 206/2

Part 2. The minimum distance where you cannot satisfy highway code is

209 km

  • $\begingroup$ I feel like your answer to part 2 is correct. I'm guessing you (also @Oray) used some algorithms to check if 209 could work and it never did? Have we checked most of the numbers lower than 209 at this point? I don't see how anything below 200 could not work... but honestly even 209 seems surprising. $\endgroup$ – Dark Thunder Jun 12 '19 at 17:10
  • $\begingroup$ @DarkThunder the part 2 answer is 1 km further than the 208 km I found. TBH I stopped looking after another user said the 208 km was optimal and haven't been back until your comment flagged. I wasn't even clear about what part 2 was asking, you mean it could be less than the answer for part 1? $\endgroup$ – Weather Vane Jun 12 '19 at 17:19
  • $\begingroup$ @WeatherVane Do you have a solution for 200km? My gut feeling tells me that distances ending in 0 may be tricky, since you will use a lot of 0-digits starting with a distance series like 20, 40, 60. $\endgroup$ – jarnbjo Jun 12 '19 at 18:54
  • $\begingroup$ @jarnbjo there are plenty of solutions for a total distance of 200 km but that distance does not appear on any sign, so the 0s are not a problem. $\endgroup$ – Weather Vane Jun 12 '19 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.