Pythagorean quadruples: Difference between revisions

Initial FutureBasic task solution added
(Added XPL0 example.)
(Initial FutureBasic task solution added)
Line 764:
<pre>1 2 4 5 8 10 16 20 32 40 64 80 128 160 256 320 512 640 1024 1280 2048</pre>
 
 
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
_limit = 2200
 
long x, x2, y, s = 3, s1, s2, counter
long l( _limit )
long ladd( _limit * _limit * 2 )
 
for x = 1 to _limit
x2 = x * x
for y = x to _limit
ladd( x2 + y * y ) = 1
next
next
 
for x = 1 to _limit
s1 = s
s = s + 2
s2 = s
for y = x + 1 to _limit
if ladd(s1) == 1 then l(y) = 1
s1 = s1 + s2
s2 = s2 + 2
next
next
 
counter = 1
for x = 1 to _limit
if ( l(x) == 0 )
if ( counter mod 7 == 0 )
printf @"%6ld", x : counter == 1 : continue
else
printf @"%6ld\b", x
counter++
end if
end if
next
print
 
HandleEvents
</syntaxhighlight>
{{output}}
<pre>
1 2 4 5 8 10 16
20 32 40 64 80 128 160
256 320 512 640 1024 1280 2048
</pre>
=={{header|Go}}==
{{trans|FreeBASIC}}
721

edits