Jump to content

Pythagorean quadruples: Difference between revisions

Pythagorean quadruples in PureBasic
m (→‎{{header|R}}: Syntax highlighting.)
(Pythagorean quadruples in PureBasic)
Line 1,580:
{{out}}
<pre>(1 2 4 5 8 10 16 20 32 40 64 80 128 160 256 320 512 640 1024 1280 2048)</pre>
 
=={{header|PureBasic}}==
{{trans|FreeBASIC}}
<lang PureBasic>OpenConsole()
limite.i = 2200
s.i = 3
Dim l.i(limite)
Dim ladd.i(limite * limite * 2)
 
For x.i = 1 To limite
x2.i = x * x
For y = x To limite
ladd(x2 + y * y) = 1
Next y
Next x
 
For x.i = 1 To limite
s1.i = s
s.i + 2
s2.i = s
For y = x +1 To limite
If ladd(s1) = 1
l(y) = 1
EndIf
s1 + s2
s2 + 2
Next y
Next x
 
For x.i = 1 To limite
If l(x) = 0
Print(Str(x) + " ")
EndIf
Next x
Input()
CloseConsole()</lang>
{{out}}
<pre>1 2 4 5 8 10 16 20 32 40 64 80 128 160 256 320 512 640 1024 1280 2048</pre>
 
=={{header|Python}}==
2,136

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.