Tile a square with 5 rectangles with edges in [1,10]

11*11 = 121 = 10*2 + 6*1 + 7*4 + 9*3 + 8*5

11*11 = 121 = 10*5 + 9*1 + 7*4 + 6*3 + 8*2

13*13 = 169 = 10*5 + 7*3 + 2*1 + 9*8 + 6*4

13*13 = 169 = 10*6 + 8*3 + 2*1 + 9*7 + 5*4
Here's a diagram showing the "Geeometree" involved (Toby Speak for "Geometry").
n8 n7
+-----+-------------------------------------+
+ + +
+ + + n6
n1 + + +
+ +------------------------------+------+
+ + n10 + +
+ + + +
+ + n9 + +
+ + + +
+-----+------------------------------+ + n5
+ + +
+ + +
n2 + + +
+ + +
+------------------------------------+------+
n3 n4
Here's a sample run of tile.tc, a tiny-c program that
figures out all possible solutions of the tiling problem.
tc>.r tile.tc
1697
0 55 1697 88303
tc>.tile
tile.tc - tct - 2/22/9
n1= 10 n2= 1 n3= 6 n4= 5 n5= 8 n6= 3 n7= 9 n8= 2 n9= 7 n10= 4
n1= 10 n2= 1 n3= 9 n4= 2 n5= 8 n6= 3 n7= 6 n8= 5 n9= 7 n10= 4
n1= 10 n2= 3 n3= 7 n4= 6 n5= 4 n6= 9 n7= 8 n8= 5 n9= 1 n10= 2
n1= 10 n2= 3 n3= 8 n4= 5 n5= 4 n6= 9 n7= 7 n8= 6 n9= 1 n10= 2
tc>.x
Here's the source code of tile.tc.
/* tile.tc - tct - 2/22/9
/* this program tiles a square w/ 5 rectangles. the sides of the rectangles
/* have lengths in [1,10]. all 10 lengths are used.
/* the tiling consists of 4 edge rectangles and 1 interior rectangle.
/* the edge rectangles form "butt joints." we label the sides along the
/* outer edge n1 thru n8. the inner rectangle's sides are labeled n9 and n10.
three int n,m,l [
return n==m+l
]
min int n,m [
if (n<m) return n
return m
]
tile [
hilo '1';color '6';pl "";ps "tile.tc - tct - 2/22/9";pl "";color '7'
int n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,w
n1=10
for (n2=1;n2<=9;++n2) [
for (n3=1;n3<=9;++n3) [
if !((n3==n2)) [
for (n4=1;n4<=9;++n4) [
if !((n4==n3)+(n4==n2)) [
for (n5=1;n5<min(10,n1+n2);++n5) [
if !((n5==n4)+(n5==n3)+(n5==n2)) [
for (n6=1;n6<min(10,n1+n2);++n6) [
if !((n6==n5)+(n6==n4)+(n6==n3)+(n6==n2)) [
for (n7=1;n7<min(10,n3+n4);++n7) [
if !((n7==n6)+(n7==n5)+(n7==n4)+(n7==n3)+(n7==n2)) [
for (n8=1;n8<min(10,n3+n4);++n8) [
if !((n8==n7)+(n8==n6)+(n8==n5)+(n8==n4)+(n8==n3)+(n8==n2)) [
for (n9=1;n9<min(n5,n1);++n9) [
if !((n9==n8)+(n9==n7)+(n9==n6)+(n9==n5)+(n9==n4)+(n9==n3)+(n9==n2)) [
for (n10=1;n10<min(n3,n7);++n10) [
if !((n10==n9)+(n10==n8)+(n10==n7)+(n10==n6)+(n10==n5)+(n10==n4)+(n10==n3)+(n10==n2)) [
w=n1+n2
if (three(w,n6,n5))
if (three(w,n8,n7))
if (three(w,n3,n4))
if (three(n3,n10,n8))
if (three(n7,n10,n4))
if (three(n5,n2,n9))
if (three(n1,n9,n6)) [
pl "";ps "n1=";pn n1;ps " n2=";pn n2;ps " n3=";pn n3;ps " n4=";pn n4;ps " n5=";pn n5
ps " n6=";pn n6;ps " n7=";pn n7;ps " n8=";pn n8;ps " n9=";pn n9;ps " n10=";pn n10
]
]]]]]]]]]]]]]]]]]
pl ""
]
Here's a description of the program.
The program tiles a square with 5 rectangles.
It contains a nested series of loops which exhaust all combinations of the numbers 1 thru 10
which 1. contain each number exactly once and 2. satisfy inequalities implied by "geeometree."
For example: n9 < minimum n5,n1
The innermost loop uses a nested if which uses a function which returns true when its
arguments satisfy a certain equality. The equalities are implied by "geeometree."
For example: n5 = n9+n2
When all requirements are met, the 10 numbers are displayed.
|