Pythagorean quadruples: Difference between revisions
Content added Content deleted
(fix tests, port another answer from scala) |
m (→{{header|Rust}}: correction) |
||
Line 1,779: | Line 1,779: | ||
This is equivalent to https://oeis.org/A094958 |
This is equivalent to https://oeis.org/A094958 |
||
which simply contains positive integers of the form 2^n or 5*2^n |
which simply contains positive integers of the form 2^n or 5*2^n. Multiple implementations are provided. |
||
<lang rust> |
<lang rust> |
||
Line 1,794: | Line 1,794: | ||
fn a094958_filter() -> Vec<u16> { |
fn a094958_filter() -> Vec<u16> { |
||
(1..2200) // ported from |
(1..2200) // ported from Sidef |
||
.filter(|n| ((n & (n - 1) == 0) || (n % 5 == 0 && ((n / 5) & (n / 5 - 1) == 0)))) |
.filter(|n| ((n & (n - 1) == 0) || (n % 5 == 0 && ((n / 5) & (n / 5 - 1) == 0)))) |
||
.collect() |
.collect() |