Largest difference between adjacent primes: Difference between revisions

Content added Content deleted
(Add Factor)
(→‎{{header|Factor}}: add link to detailed explanation)
Line 93: Line 93:


=={{header|Factor}}==
=={{header|Factor}}==
See [[Largest difference between adjacent primes/Factor]] for a detailed explanation because why not?
{{works with|Factor|0.99 2021-06-02}}
{{works with|Factor|0.99 2021-06-02}}
<lang factor>USING: arrays formatting kernel lists lists.lazy math math.order
<lang factor>USING: arrays formatting kernel lists lists.lazy math math.order
Line 98: Line 99:


lprimes dup cdr lzip [ first2 2dup swap - -rot 3array ] lmap-lazy
lprimes dup cdr lzip [ first2 2dup swap - -rot 3array ] lmap-lazy
[ last 1e6 < ] lwhile { 0 } [ max ] foldl
[ second 1e6 < ] lwhile { 0 } [ max ] foldl


"Largest difference in adjacent primes under a million: %d between %d and %d.\n" vprintf</lang>
"Largest difference in adjacent primes under a million: %d between %d and %d.\n" vprintf</lang>