Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,36 +0,0 @@
|
|||
For i=1 To 8
|
||||
WScript.StdOut.WriteLine triples(10^i)
|
||||
Next
|
||||
|
||||
Function triples(pmax)
|
||||
prim=0 : count=0 : nmax=Sqr(pmax)/2 : n=1
|
||||
Do While n <= nmax
|
||||
m=n+1 : p=2*m*(m+n)
|
||||
Do While p <= pmax
|
||||
If gcd(m,n)=1 Then
|
||||
prim=prim+1
|
||||
count=count+Int(pmax/p)
|
||||
End If
|
||||
m=m+2
|
||||
p=2*m*(m+n)
|
||||
Loop
|
||||
n=n+1
|
||||
Loop
|
||||
triples = "Max Perimeter: " & pmax &_
|
||||
", Total: " & count &_
|
||||
", Primitive: " & prim
|
||||
End Function
|
||||
|
||||
Function gcd(a,b)
|
||||
c = a : d = b
|
||||
Do
|
||||
If c Mod d > 0 Then
|
||||
e = c Mod d
|
||||
c = d
|
||||
d = e
|
||||
Else
|
||||
gcd = d
|
||||
Exit Do
|
||||
End If
|
||||
Loop
|
||||
End Function
|
||||
Loading…
Add table
Add a link
Reference in a new issue