Neighbour primes: Difference between revisions
Content added Content deleted
(→{{header|REXX}}: added the computer programming language REXX.) |
(Realize in F#) |
||
Line 52: | Line 52: | ||
</pre> |
</pre> |
||
=={{header|F_Sharp|F#}}== |
|||
This task uses [http://www.rosettacode.org/wiki/Extensible_prime_generator#The_functions Extensible Prime Generator (F#)] |
|||
<lang fsharp> |
|||
// Nigel Galloway. April 13th., 2021 |
|||
primes32()|>Seq.pairwise|>Seq.takeWhile(fun(n,_)->n<500)|>Seq.filter(fun(n,g)->isPrime(n*g+2))|>Seq.iter(fun(n,g)->printfn "%d*%d=%d" n g (n*g+2)) |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
3*5=17 |
|||
5*7=37 |
|||
7*11=79 |
|||
13*17=223 |
|||
19*23=439 |
|||
67*71=4759 |
|||
149*151=22501 |
|||
179*181=32401 |
|||
229*233=53359 |
|||
239*241=57601 |
|||
241*251=60493 |
|||
269*271=72901 |
|||
277*281=77839 |
|||
307*311=95479 |
|||
313*317=99223 |
|||
397*401=159199 |
|||
401*409=164011 |
|||
419*421=176401 |
|||
439*443=194479 |
|||
487*491=239119 |
|||
Real: 00:00:00.029 |
|||
</pre> |
|||
=={{header|Factor}}== |
=={{header|Factor}}== |
||
{{works with|Factor|0.99 2021-02-05}} |
{{works with|Factor|0.99 2021-02-05}} |