Yesterday was Babylonian/Pythagorean triple day 9/16/25 (a unique day, as one can quickly check also with Mathematica) and I took the opportunity to write something in Mathematica about the Elkies puzzle illustrating 3^3+4^3+5^3=6^3.
To check that there is only one Pythagorean triple day of the form Month/Day/Year, test it with the following line
In[]:=
Select[Tuples[{Range[3]^2,Range[5]^2}],IntegerQ[Sqrt[Total[#]]]&]
Out[]=
{{9,16}}
Noam Elkies once constructed a puzzle illustrating the identity 3^3 + 4^3 + 5^3 = 6^3. He also solved the task to illustrate this with the least amount of puzzle pieces, if each puzzle piece has to be a union of cuboids: every puzzle piece can hit only one corner and every corner has to be covered. it is a nice illustration of the pigeon hole principle. Here is a Mathematica implementation.
Defining a function cuboid that creates a cuboid at a specified position
{x,y,z}
with dimensions slightly less than 1 unit in each direction, providing a visual representation of 3D blocks.
In[]:=
cuboid[{x_,y_,z_}]:=Cuboid[{x,y,z},{x+0.95,y+0.95,z+0.95}];
Constructing Puzzle Pieces: Defining functions
A
and
B
to generate collections of cuboids.
A
creates a grid of cuboids with given dimensions, while
B
adds an additional row of cuboids to the grid. The code initializes eight distinct sets of colored puzzle pieces, each translated to specific positions in a 3D space.
In[]:=
A[a_,b_,c_]:=Table[cuboid[{i,j,k}],{i,a},{j,b},{k,c}];​​B[a_,b_,c_]:=Union[Flatten[Table[cuboid[{i,j,k}],{i,a},{j,b},{k,c}]],Table[cuboid[{a+1,b,k}],{k,c}]];​​A1={Red,A[3,4,1]};A2={Green,Translate[A[3,5,1],{6,0,0}]};​​A3={Blue,Translate[A[4,4,2],{0,6,0}]};A4={Yellow,Translate[A[4,4,4],{5,6,0}]};​​A5={Pink,Translate[B[2,5,1],{5,11,0}]};A6={Orange,Translate[B[2,5,5],{0,11,0}]};​​A7={Purple,Translate[B[2,2,3],{10,0,0}]};A8={Cyan,Translate[B[1,3,3],{10,3,0}]};
Defining a function
Separate
that creates a 3D graphic of puzzle pieces arranged separately. It uses transformations and rotations to position various pieces uniquely in space, creating a visual representation of the puzzle components.
In[]:=
Separate[t_]:=Graphics3D[{A4,A6,Translate[Rotate[A7,t*Pi/2,{0,0,1}],t*{10,2,0}],Translate[Rotate[A8,t*2Pi/2,{0,1,0}],t*{21,9,5}],Translate[Rotate[Rotate[A2,t*Pi/2,{1,0,0}],t*Pi/2,{0,0,1}],t*{2,6,0}],Translate[Rotate[A3,t*Pi/2,{0,1,0}],t*{3,6,7}],Translate[Rotate[A1,t*Pi/2,{1,0,0}],t*{2,14,1}],Translate[Rotate[A5,t*Pi,{0,0,1},{3,3,0}],t*{6,23,0}]},Boxed->False,Axes->False];
Defining a function
Combined
that arranges puzzle pieces into a single, cohesive structure using transformations and rotations. It combines two parts of puzzle pieces and rotates them to form a complete 3D puzzle illustration.
In[]:=
Combined[t_]:=Module[{},Part1={A6,Translate[A5,t{-5,0,5}],Translate[A4,t{-3,5,0}],Translate[A3,t{2,5,4}]};​​Part2={Translate[Rotate[Rotate[A1,t*Pi/2,{1,0,0}],t*Pi/2,{0,1,0}],t{12,3,5}],Translate[Rotate[Rotate[A2,t*Pi/2,{1,0,0}],t*Pi/2,{0,1,0}],t{11,3,14}],A7,Translate[Rotate[Rotate[A8,t*Pi,{1,0,0}],-t*Pi/2,{0,0,1}],t{18,14,8}]};​​Graphics3D[{Part1,Translate[Rotate[Part2,t*Pi,{0,0,1}],t{18,19,0}]},Boxed->False,Axes->False]];
The function
Noam[t]
creates a visual representation of the puzzle pieces, either separated or combined, depending on the parameter t. When t is less than or equal to 1, it displays the puzzle pieces separately using the
Separate
function. When t is greater than 1, it shows a combined structure using the
Combined
function. The aspect ratio is set to 1 for consistent visualization.
In[]:=
Noam[t_]:=Show[If[t<=1,Separate[1-t],Combined[t-1]],AspectRatio->1];
The following code initializes several 3D puzzle pieces using the functions
A
and
B
, translating them to specific positions in the 3D space. Each puzzle piece is represented as a collection of cuboids and displayed using
Graphics3D
. The result is a visual of all the puzzle components arranged together, which can be further exported for 3D printing.
Manipulate[Noam[t],{t,0,2},SaveDefinitions->True]
Out[]=
​
t
In[]:=
​​{Noam[0],Noam[1],Noam[2]}
Out[]=

,
,

And here is a short Mathematica implementation which allows to 3D print the puzzle.
In[]:=
A[a_,b_,c_]:=Table[Cuboid[{i,j,k}],{i,a},{j,b},{k,c}];​​B[a_,b_,c_]:=Union[Flatten[Table[Cuboid[{i,j,k}],{i,a},{j,b},{k,c}]],Table[Cuboid[{a+1,b,k}],{k,c}]];​​A1=Translate[A[3,4,1],{0,0,0}];A2=Translate[A[3,5,1],{6,0,0}];​​A3=Translate[A[4,4,2],{0,6,0}];A4=Translate[A[4,4,4],{5,6,0}];​​A5=Translate[B[2,5,1],{5,11,0}];A6=Translate[B[2,5,5],{0,0+11,0}];​​A7=Translate[B[2,2,3],{10,0,0}];A8=Translate[B[1,3,3],{10,3,0}];​​S=Graphics3D[{A1,A2,A3,A4,A5,A6,A7,A8}]
Out[]=
Exporting the visual representation of the puzzle pieces contained in
S
to an STL file named “noam.stl”.
Export["noam.stl",S,"STL"]

References

Denis Serre (2011), cube + cube + cube = cube, https://mathoverflow.net/questions/53048

CITE THIS NOTEBOOK

Pythagorean triple day: the Elkies puzzle​
by Oliver Knill​
Wolfram Community, STAFF PICKS, September 17, 2025
​https://community.wolfram.com/groups/-/m/t/3546742