Minimum number of cells after, before, above and below NxN squares: Difference between revisions

add fermat
(add parigp)
(add fermat)
Line 676:
 
0
</pre>
 
=={{header|Fermat}}==
<lang fermat>
Func Min(a, b) = if a<=b then a else b fi.;
n:=10;
Array x[n, n];
[x]:= [<i=1,n> <j=1,n> Min(Min(i-1,n-i),Min(j-1,n-j))];
[x];
</lang>
{{out}}<pre>
[[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, `
0, 1, 1, 1, 1, 1, 1, 1, 1, 0, `
0, 1, 2, 2, 2, 2, 2, 2, 1, 0, `
0, 1, 2, 3, 3, 3, 3, 2, 1, 0, `
0, 1, 2, 3, 4, 4, 3, 2, 1, 0, `
0, 1, 2, 3, 4, 4, 3, 2, 1, 0, `
0, 1, 2, 3, 3, 3, 3, 2, 1, 0, `
0, 1, 2, 2, 2, 2, 2, 2, 1, 0, `
0, 1, 1, 1, 1, 1, 1, 1, 1, 0, `
0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]]
</pre>
 
781

edits