tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
15
Task/Pythagorean-triples/PARI-GP/pythagorean-triples.pari
Normal file
15
Task/Pythagorean-triples/PARI-GP/pythagorean-triples.pari
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
do(lim)={
|
||||
my(prim,total,P);
|
||||
lim\=1;
|
||||
for(m=2,sqrtint(lim\2),
|
||||
forstep(n=1+m%2,min(sqrtint(lim-m^2),m-1),2,
|
||||
P=2*m*(m+n);
|
||||
if(gcd(m,n)==1 && P<=lim,
|
||||
prim++;
|
||||
total+=lim\P
|
||||
)
|
||||
)
|
||||
);
|
||||
[prim,total]
|
||||
};
|
||||
do(100)
|
||||
Loading…
Add table
Add a link
Reference in a new issue