%% auteur : Dominique Petit -0.5 6.5 setxrange -0.5 6 setyrange /c 6 def %%côté du carré /C {c 0} def %%on dessine le carré initial en noir /D {0 0} def /A {0 c} def /B {c c} def /fillstyle {noir fill} def [A B C D] polygone* /i 1 def %%nombre d'itérations /min c def %%côté du plus petit carré /carré { /c c 3 div def gsave currentpoint translate min c gt { newpath c c neg smoveto c 0 srlineto 0 c neg srlineto c neg 0 srlineto clip blanc fill } { c carré c 0 smoveto c carré 2 c mul 0 smoveto c carré 2 c mul c neg smoveto c carré 0 c neg smoveto c carré 2 c mul 2 c mul neg smoveto c carré c 2 c mul neg smoveto c carré 0 2 c mul neg smoveto c carré } ifelse grestore /c 3 c mul def }def /itération { c carré /min min 3 div def }def A smoveto i {itération} repeat