Pythagorean quadruples: Difference between revisions
Content added Content deleted
(Added Wren) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 34: | Line 34: | ||
:* the Wikipedia article: [https://en.wikipedia.org/wiki/Pythagorean_quadruple Pythagorean quadruple]. |
:* the Wikipedia article: [https://en.wikipedia.org/wiki/Pythagorean_quadruple Pythagorean quadruple]. |
||
<br><br> |
<br><br> |
||
=={{header|11l}}== |
|||
{{trans|Python}} |
|||
<lang 11l>F quad(top = 2200) |
|||
V r = [0B] * top |
|||
V ab = [0B] * (top * 2)^2 |
|||
L(a) 1 .< top |
|||
L(b) a .< top |
|||
ab[a * a + b * b] = 1B |
|||
V s = 3 |
|||
L(c) 1 .< top |
|||
(V s1, s, V s2) = (s, s + 2, s + 2) |
|||
L(d) c + 1 .< top |
|||
I ab[s1] |
|||
r[d] = 1B |
|||
s1 += s2 |
|||
s2 += 2 |
|||
R enumerate(r).filter((i, val) -> !val & i).map((i, val) -> i) |
|||
print(quad())</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|ALGOL 68}}== |
=={{header|ALGOL 68}}== |