17 lines
408 B
Text
17 lines
408 B
Text
{floyd(m)=my(lastrow_a,lastrow_e,lastrow_len=m,fl,idx);
|
|
\\ +++ fl is a vector of fieldlengths in the last row
|
|
lastrow_e=m*(m+1)/2;lastrow_a=lastrow_e+1-m;
|
|
fl=vector(lastrow_len);
|
|
for(k=1,m,fl[k] = 1 + #Str(k-1+lastrow_a) );
|
|
\\
|
|
idx=0;
|
|
for(i=1,m,
|
|
for(j=1,i,
|
|
idx++;
|
|
printf(Str("%" fl[j] "d"),idx)
|
|
);
|
|
print()
|
|
);
|
|
return();}
|
|
floyd(5)
|
|
floyd(14)
|