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

add parigp
(add gwbasic)
(add parigp)
Line 1,010:
Minimum number of cells after, before, above and below 1 x 1 square:
0</pre>
 
=={{header|PARI/GP}}==
<lang parigp>
n=10
matrix(n,n,i,j,min(min(i-1,n-i),min(j-1,n-j)))
</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>
 
=={{header|Pascal}}==
781

edits