# The Palindromic Diamond Cube

Inspired by this question.

A wealthy, famous eccentric had a huge cube of equal sized diamonds.* Due to her eccentricities the number of diamonds was known to be both palindromic in base ten, and a multiple of $7$ - her lucky number.

* That is a cube of $n^3 | n \in \Bbb{N}$ diamonds.

One day $7$ thieves stole the cube and got away in a spaceship. They planned to break the cube up to share the diamonds out equally, since it would be too difficult to sell such a unique piece anywhere in the system.

During the flight $2$ of the thieves decided to do away with the other $5$ thieves and share the diamonds equally, however they found that $1$ diamond would be left over.

As they discovered this a third thief discovered them, and suggested they do away with the other $4$ thieves instead and again share the diamonds equally. Again there would be $1$ diamond left over, and again as they discovered this a fourth thief discovered them.

The process repeated until the seventh thief found the others plotting against him, and still with a single remaining diamond after splitting them into $6$ equal shares.

What was the minimum number of diamonds in the cube?

• The Seventh thief found them and found there'd be 1 left after spitting it in SIX? equal shares? What about thief #7 doesn't he get diamonds? – dcfyj Jun 10 '16 at 12:07
• @dcfyj When the $6$ were sharing equally there would be $1$ remaining diamond. They already know the number of diamonds is divisible by $7$ due to the well publicised peculiarities of the famous eccentric. – Jonathan Allan Jun 10 '16 at 12:12

I believe there were

1033394994933301 diamonds, in a cube 101101 on a side.

Solution by semi-brainless computer search. Here's the code (though the code I actually used -- and briefly had here -- had a stupid bug which by mere good luck happened not to make it find the wrong answer).

for n in range(1,100000000):
m = 420*n+301
m = m**3 # number is a cube
s = str(m)
if s != s[::-1]: continue
print(n,m)
break


The only non-obvious things here are:

• m = 420*n+301: for k=2,3,4,5,6 it happens that $n^3=1$ mod k iff $n=1$ mod k, so the side length of our cube must be 1 mod 60. It also happens to be a multiple of 7, which means it needs to be 301 mod 420 as per the earlier puzzle linked from the question here.
• s[::-1]: terse but unobvious Pythonese for reversing a sequence.
• $1685^3=4,784,094,125$, not 1033394994933301. – Trenin Jun 10 '16 at 12:34
• Er, no, sorry, 1685 is the value of n, not of 60n+1. Will fix. – Gareth McCaughan Jun 10 '16 at 12:35
• 1685 per side there are 6 sides to a cube – dcfyj Jun 10 '16 at 12:35
• @dcfyj Um... what? – Trenin Jun 10 '16 at 12:36
• And 7 divides 101101, too. – Rosie F Jun 10 '16 at 12:38

You don't actually say that when the 5th thief discovered the other 4 and demanded that the diamonds be divided into 5, that there would be 1 left over. So I suggest that there are 343 diamonds.

• "The process repeated" – Jonathan Allan Jun 10 '16 at 12:32
• upv for creativity though :) – Jonathan Allan Jun 10 '16 at 12:39

I believe the answer is:

10801 diamonds

because

if divided by 7 you get 1543 and if divided by any of the other numbers you get a remainder of 1. And also because it's the lowest palindromic number that fits the bill

I found the answer by using this:

vb.net code
For i As Integer = 0 To 50000
If i Mod 7 = 0 AndAlso i Mod 6 = 1 AndAlso i Mod 5 = 1 AndAlso i Mod 4 = 1 AndAlso i Mod 3 = 1 AndAlso i Mod 2 = 1 Then
txtPass.Text &= i.ToString() & "| "
End If
Next

• Unfortunately the answer you have given is not a cube of a natural number. – Jonathan Allan Jun 10 '16 at 12:21
• That wasn't stated in the question, but ok. – dcfyj Jun 10 '16 at 12:22
• I will add it explicitly to the text, I'd thought "cube of equal sized diamonds" was enough to specify this fact. – Jonathan Allan Jun 10 '16 at 12:23
• To me that just sounded like a cube, as in a boxed shaped object – dcfyj Jun 10 '16 at 12:24