kochvlocanim := proc (n) 
local i, c, eliste, dliste, schritt, rekplot; 
eliste:= [[0, 0], [1, 0], [1/2, 1/2*sqrt(3)], [0, 0]]; 
dliste := [[[0, 0], [1, 0], [1/2, 1/2*sqrt(3)]]]; 
schritt := proc (eliste, dliste) 
local ne, i, tp, s, satz, teilpunkte, spitze, neliste, ndliste, nd; 
teilpunkte := proc (anfangspunkt, endpunkt) local t1, t2; 
t1 := [2/3*op(1,anfangspunkt)+1/3*op(1,endpunkt), 
2/3*op(2,anfangspunkt)+1/3*op(2,endpunkt)]; 
t2 := [1/3*op(1,anfangspunkt)+2/3*op(1,endpunkt), 
1/3*op(2,anfangspunkt)+2/3*op(2,endpunkt)]; [t1, t2] 
end; 
spitze := proc (t1, t2) local betrag; 
betrag := sqrt((op(1,t2)-op(1,t1))^2+(op(2,t2)-op(2,t1))^2); 
[1/2*op(1,t1)+1/2*op(1,t2)+1/2*sqrt(3)*(op(2,t2)-op(2,t1)
), 1/2*op(2,t1)+1/2*op(2,t2)-1/2*sqrt(3)*(op(1,t2)-op(1,t1))] 
end; 
neliste := []; ndliste := []; 
for i to nops(eliste)-1 do 
tp := teilpunkte(op(i,eliste),op(i+1,eliste)); 
s := spitze(op(1,tp),op(2,tp)); 
satz := [op(i,eliste), op(1,tp), s, op(2,tp)]; 
neliste := [op(neliste), op(satz)]; 
nd := [op(1,tp), s, op(2,tp)]; 
ndliste := [op(ndliste), nd] 
od; 
neliste := [op(neliste),op(1,neliste)]; [neliste, ndliste] 
end; 
rekplot := proc (el, dl, ebene, tiefe) 
global a, b, d; 
option remember; 
if 0 < ebene then 
b[tiefe-ebene+1] :=plots[polygonplot](el,style = PATCH); 
a[tiefe-ebene+1] := plots[polygonplot](dl,style = PATCH); 
d[tiefe-ebene+1] := plots[polygonplot](dl,style = PATCH); 
rekplot(op(1,schritt(el,dl)),op(2,schritt(el,dl)),ebene-1,tiefe) 
fi 
end; 
rekplot(eliste,dliste,n,n); 
for i to n do c[i] := plots[display]([b[i]]) od; 
i := 'i'; 
plots[display]([`$`(c[i],i = 1 .. n)],insequence = true,axes= none,scaling = constrained) 
end;