Minimum number of cells after, before, above and below NxN squares: Difference between revisions
Minimum number of cells after, before, above and below NxN squares (view source)
Revision as of 11:05, 15 November 2021
, 2 years agoadd 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}}==
|