Floyd's triangle: Difference between revisions
Content added Content deleted
Line 4,257: | Line 4,257: | ||
=={{header|PARI/GP}}== |
=={{header|PARI/GP}}== |
||
⚫ | |||
\\ +++ 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); |
|||
⚫ | |||
⚫ | |||
lastrowe=m*(m+1)/2;lastrowa=lastrowe+1-m;lastrowlen=m; |
|||
\\ |
|||
vecfieldlen=vector(lastrowlen); |
|||
idx=0; |
|||
⚫ | |||
⚫ | |||
il=1; printf(Str("%" fl[1]-1 "d"),il);print(); |
|||
⚫ | |||
for(j=1,i, |
for(j=1,i, |
||
idx++; |
|||
printf(Str("%" fl[j] |
printf(Str("%" fl[j] "d"),idx) |
||
); |
); |
||
print() |
print() |
||
); |
); |
||
return()} |
return();} |
||
floyd(5) |
floyd(5) |
||
floyd(14) |
floyd(14) |