# To Plunder Treasure Islands

Captain Etarip, wants to plunder all the treasure islands that he can. There is exactly one island for every $n\in\mathbb N$. The $n^{\text{th}}$ treasure island contains three cities, each with $n$ golden coins. Once he begins his quest, he will visit them from poorest to richest, until the end of time.

When going on a new trip, a fleet of exactly three ships is available for rent from the local mathematician, one for each city on the island. Depending on $r^{\text{th}}$ prime number he offers as a sacrifice to the mathematician, he is given ships ranked with $r+1,r+2,r+3$ ranks.

To make his trip profitable and possible, every rank $r$ ship in fleet must satisfy the following terms:

• A rank $r$ ship can at best carry less than $r$ containers and would need to carry at least one container. Each container on board needs to be filled with exactly $r$ boxes, where each box needs to be filled with exactly $r$ coins. There may be at best less than $r$ boxes on deck (ones that aren't in any of the containers).

• Each container requires exactly one crew member. Each needs to be paid one golden coin.
Rogue crew members not attending containers are not allowed on board.

• All coins carried on a ship must either be in boxes or paid to crew members.
Otherwise, the ship would attract rival pirates and you don't want any trouble.

• Etarip will only target islands from which he can take all the coins.

For example, a rank $7$ ship that plans to carry $135$ coins would have two containers ($2\cdot7^2$ coins), five boxes ($5\cdot7$ coins) and two crew member ($2$ coins) to successfully transport them. But that same ship can't carry $140$ coins for example, as there are $5$ coins you can't fit anywhere on board as you are $2$ coins short for a sixth box.

A rank $7$ ship can be obtained by offering $4^{\text{th}},5^{\text{th}}$ or $6^{\text{th}}$ prime number. But one ship being able to raid a city does not guarantee that you can plunder that island. All three ships in the fleet must satisfy the conditions, as each is assigned to an equivalent city.

Given all this, can you find all the islands that Etarip will eventually plunder?
Can you prove that you have found all of them? (set of all such islands is not finite)

Will you use this information to help warn the residents of treasure islands on time, or to perhaps start your own pillaging conquest and gain advantage over Captain Etarip by predicting his next raids, is up to you. Just hurry, before he starts sailing.

Plunderable Island example:

One of the islands that Etarip will plunder is the:

$300^{\text{th}}$ island.

Which is possible to plunder because:

By sacrificing the $6^{\text{th}}$ prime number, we can take all the coins:

Class $7$ ship: $6$ containers (and crew members) and $0$ boxes. ($6\cdot50+0\cdot7=300$)
Class $8$ ship: $4$ containers (and crew members) and $5$ boxes. ($4\cdot65+5\cdot8=300$)
Class $9$ ship: $3$ containers (and crew members) and $6$ boxes. ($3\cdot82+6\cdot9=300$)

• Is the fact that you're sacrificing prime numbers mean anything (other than being thematic)? Mar 19 '18 at 21:47
• @DqwertyC The intended purpose of "sacrificing prime numbers" was being thematic. Mar 19 '18 at 21:56

There is no end to the islands. They are the numbers that are non-trivial three-digit palindromes in three consecutive bases.

As pointed out by Mike Earnest, this is a subset of:

Numbers that are nontrivially palindromic in three or more consecutive integer bases, which contains at least two infinite sequences.

In particular, from the OEIS link:

For each j >= 5 and odd, (j^3 + 6*j^2 + 14*j + 11)/2 is a term in the sequence, and represents a number that is nontrivially palindromic in bases j+1, j+2, and j+3; the digits of (j^3 + 6*j^2 + 14*j + 11)/2 in those three bases are [(j+3)/2, (j+5)/2, (j+3)/2], [(j+1)/2, (j+3)/2, (j+1)/2], and [(j-1)/2, (j+7)/2, (j-1)/2], respectively (see 178 and 373 in the Example section). Nearly all of the first 95 terms of this sequence are terms of this form.

I ran a program to check up to r = 97. With the notable exception of 300, they are all of the form above:

178 base 10 == 4,5,4 base 6 == 3,4,3 base 7 == 2,6,2 base 8.
300 base 10 == 6,0,6 base 7 == 4,5,4 base 8 == 3,6,3 base 9.
373 base 10 == 5,6,5 base 8 == 4,5,4 base 9 == 3,7,3 base 10.
676 base 10 == 6,7,6 base 10 == 5,6,5 base 11 == 4,8,4 base 12.
1111 base 10 == 7,8,7 base 12 == 6,7,6 base 13 == 5,9,5 base 14.
1702 base 10 == 8,9,8 base 14 == 7,8,7 base 15 == 6,10,6 base 16.
2473 base 10 == 9,10,9 base 16 == 8,9,8 base 17 == 7,11,7 base 18.
3448 base 10 == 10,11,10 base 18 == 9,10,9 base 19 == 8,12,8 base 20.
4651 base 10 == 11,12,11 base 20 == 10,11,10 base 21 == 9,13,9 base 22.
6106 base 10 == 12,13,12 base 22 == 11,12,11 base 23 == 10,14,10 base 24.
7837 base 10 == 13,14,13 base 24 == 12,13,12 base 25 == 11,15,11 base 26.
9868 base 10 == 14,15,14 base 26 == 13,14,13 base 27 == 12,16,12 base 28.
12223 base 10 == 15,16,15 base 28 == 14,15,14 base 29 == 13,17,13 base 30.
14926 base 10 == 16,17,16 base 30 == 15,16,15 base 31 == 14,18,14 base 32.
18001 base 10 == 17,18,17 base 32 == 16,17,16 base 33 == 15,19,15 base 34.
21472 base 10 == 18,19,18 base 34 == 17,18,17 base 35 == 16,20,16 base 36.
25363 base 10 == 19,20,19 base 36 == 18,19,18 base 37 == 17,21,17 base 38.
29698 base 10 == 20,21,20 base 38 == 19,20,19 base 39 == 18,22,18 base 40.
34501 base 10 == 21,22,21 base 40 == 20,21,20 base 41 == 19,23,19 base 42.
39796 base 10 == 22,23,22 base 42 == 21,22,21 base 43 == 20,24,20 base 44.
45607 base 10 == 23,24,23 base 44 == 22,23,22 base 45 == 21,25,21 base 46.
51958 base 10 == 24,25,24 base 46 == 23,24,23 base 47 == 22,26,22 base 48.
58873 base 10 == 25,26,25 base 48 == 24,25,24 base 49 == 23,27,23 base 50.
66376 base 10 == 26,27,26 base 50 == 25,26,25 base 51 == 24,28,24 base 52.
74491 base 10 == 27,28,27 base 52 == 26,27,26 base 53 == 25,29,25 base 54.
83242 base 10 == 28,29,28 base 54 == 27,28,27 base 55 == 26,30,26 base 56.
92653 base 10 == 29,30,29 base 56 == 28,29,28 base 57 == 27,31,27 base 58.
102748 base 10 == 30,31,30 base 58 == 29,30,29 base 59 == 28,32,28 base 60.
113551 base 10 == 31,32,31 base 60 == 30,31,30 base 61 == 29,33,29 base 62.
125086 base 10 == 32,33,32 base 62 == 31,32,31 base 63 == 30,34,30 base 64.
137377 base 10 == 33,34,33 base 64 == 32,33,32 base 65 == 31,35,31 base 66.
150448 base 10 == 34,35,34 base 66 == 33,34,33 base 67 == 32,36,32 base 68.
164323 base 10 == 35,36,35 base 68 == 34,35,34 base 69 == 33,37,33 base 70.
179026 base 10 == 36,37,36 base 70 == 35,36,35 base 71 == 34,38,34 base 72.
194581 base 10 == 37,38,37 base 72 == 36,37,36 base 73 == 35,39,35 base 74.
211012 base 10 == 38,39,38 base 74 == 37,38,37 base 75 == 36,40,36 base 76.
228343 base 10 == 39,40,39 base 76 == 38,39,38 base 77 == 37,41,37 base 78.
246598 base 10 == 40,41,40 base 78 == 39,40,39 base 79 == 38,42,38 base 80.
265801 base 10 == 41,42,41 base 80 == 40,41,40 base 81 == 39,43,39 base 82.
285976 base 10 == 42,43,42 base 82 == 41,42,41 base 83 == 40,44,40 base 84.
307147 base 10 == 43,44,43 base 84 == 42,43,42 base 85 == 41,45,41 base 86.
329338 base 10 == 44,45,44 base 86 == 43,44,43 base 87 == 42,46,42 base 88.
352573 base 10 == 45,46,45 base 88 == 44,45,44 base 89 == 43,47,43 base 90.
376876 base 10 == 46,47,46 base 90 == 45,46,45 base 91 == 44,48,44 base 92.
402271 base 10 == 47,48,47 base 92 == 46,47,46 base 93 == 45,49,45 base 94.
428782 base 10 == 48,49,48 base 94 == 47,48,47 base 95 == 46,50,46 base 96.
456433 base 10 == 49,50,49 base 96 == 48,49,48 base 97 == 47,51,47 base 98.
485248 base 10 == 50,51,50 base 98 == 49,50,49 base 99 == 48,52,48 base 100.

• Did you type all of that out? :O Or did you write some neat code :P Mar 20 '18 at 2:51
• var triple = new RaidableTriple(numberToCheck, startingBase); if (triple.IsRaidable) { Console.WriteLine(\$"{numberToCheck} base 10{triple}."); } Mar 20 '18 at 3:28
• Nice :) Good Job +1 Mar 20 '18 at 3:31
• Step 1: Get a sequence of numbers. Step 2: Put it in to OEIS. Step 3: Profit Mar 21 '18 at 1:15