Gaussian primes: Difference between revisions
Content added Content deleted
(→{{header|jq}}: rm extraneous comment) |
(→{{header|jq}}: streamline GPrimes) |
||
Line 236: | Line 236: | ||
# emit a stream of Gaussian primes with real and imaginary parts within the given radius |
# emit a stream of Gaussian primes with real and imaginary parts within the given radius |
||
def GPrimes($Radius): |
def GPrimes($Radius): |
||
⚫ | |||
($Radius | norm) as $R2 |
($Radius | norm) as $R2 |
||
| range(-$Radius; $Radius + 1) as $r |
| range(-$Radius; $Radius + 1) as $r |
||
| range(-$Radius; $Radius + 1) as $i |
| range(-$Radius; $Radius + 1) as $i |
||
| |
| [$r, $i] |
||
| |
| norm as $norm |
||
| select( $norm < $R2 ) |
|||
| if $i == 0 then select($r|check) |
|||
elif $r == 0 |
elif $r == 0 then select($i|check) |
||
⚫ | |||
then ($i|abs) as $m |
|||
⚫ | |||
⚫ | |||
end ; |
end ; |
||