tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
15
Task/Pascals-triangle/PARI-GP/pascals-triangle.pari
Normal file
15
Task/Pascals-triangle/PARI-GP/pascals-triangle.pari
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
pascals_triangle(N)= {
|
||||
my(row=[],prevrow=[]);
|
||||
for(x=1,N,
|
||||
if(x>5,break(1));
|
||||
row=eval(Vec(Str(11^(x-1))));
|
||||
print(row));
|
||||
prevrow=row;
|
||||
for(y=6,N,
|
||||
for(p=2,#prevrow,
|
||||
row[p]=prevrow[p-1]+prevrow[p]);
|
||||
row=concat(row,1);
|
||||
prevrow=row;
|
||||
print(row);
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue