Pythagorean quadruples: Difference between revisions

m (→‎{{header|Rust}}: flagged as having no output.)
Line 275:
{{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|AWK}}==
 
<lang AWK>
# syntax: GAWK -f PYTHAGOREAN_QUADRUPLES.AWK
# converted from Go
BEGIN {
n = 2200
s = 3
for (a=1; a<=n; a++) {
a2 = a * a
for (b=a; b<=n; b++) {
ab[a2 + b * b] = 1
}
}
for (c=1; c<=n; c++) {
s1 = s
s += 2
s2 = s
for (d=c+1; d<=n; d++) {
if (ab[s1]) {
r[d] = 1
}
s1 += s2
s2 += 2
}
}
for (d=1; d<=n; d++) {
if (!r[d]) {
printf("%d ",d)
}
}
printf("\n")
exit(0)
}
</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|C}}==
477

edits