Function Repository Resource:

BouwkampDiagram

Source Notebook

Convert Bouwkamp format into a diagram

Contributed by: Ed Pegg Jr

ResourceFunction["BouwkampDiagram"][bouw]

make a diagram out of Bouwkamp format bouw.

Details

A Bouwkamp format can also be called a Bouwkamp code or Bouwkamp notation.
The Bouwkamp format is in the form of {order, y, x, s1, s2, …}, where order is the number of squares {s1, s2, …} in the diagram and y,x are the dimensions of the outer rectangle. The {s1, s2, …} are the side lengths of the squares comprising the diagram.
A sample Bouwkamp format is {12,16,16,3,3,5,5,6,4,6,7,3,1,5,4}. This means there are 12 squares filling out a 16×16 rectangle, with the first four squares (3,3,5,5) filling up the left side. All squares fill the leftmost lowest position until the rectangle is filled completely.

Examples

Basic Examples (2) 

Turn a Bouwkamp format into a diagram:

In[1]:=
ResourceFunction[
 "BouwkampDiagram"][{12, 16, 16, 3, 3, 5, 5, 6, 4, 6, 7, 3, 1, 5, 4}]
Out[1]=

Show the input form of the diagram:

In[2]:=
InputForm[%]
Out[2]=

Scope (2) 

Show Moron's perfect rectangle (found in 1925):

In[3]:=
ResourceFunction[
 "BouwkampDiagram"][{9, 33, 32, 9, 10, 14, 8, 1, 7, 4, 18, 15}]
Out[3]=

Convert a more complicated Bouwkamp format:

In[4]:=
ResourceFunction[
 "BouwkampDiagram"][{28, 1269, 1269, 256, 264, 332, 417, 184, 64, 8, 56, 216, 120, 148, 184, 99, 318, 304, 264, 100, 64, 219, 164, 216, 321, 525, 207, 318, 105, 213, 213}]
Out[4]=

Possible Issues (1) 

Invalid Bouwkamp formats will return a failure message:

In[5]:=
ResourceFunction["BouwkampDiagram"][{7, 9, 9, 4, 4}]
Out[5]=
In[6]:=
ResourceFunction["BouwkampDiagram"][{"squares"}]
Out[6]=

Version History

  • 1.0.0 – 25 January 2023

Related Resources

License Information