RosettaCodeData/Task/Euclid-Mullin-sequence/00-TASK.txt
2023-07-01 13:44:08 -04:00

17 lines
871 B
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;Definition
The [https://en.wikipedia.org/wiki/Euclid%E2%80%93Mullin_sequence EuclidMullin sequence] is an infinite sequence of distinct prime numbers, in which each element is the least prime factor of one plus the product of all earlier elements.
The first element is usually assumed to be 2. So the second element is : (2) + 1 = 3 and the third element is : (2 x 3) + 1 = 7 as this is prime.
Although intermingled with smaller elements, the sequence can produce very large elements quite quickly and only the first 51 have been computed at the time of writing.
;Task
Compute and show here the first '''16''' elements of the sequence or, if your language does not support arbitrary precision arithmetic, as many as you can.
;Stretch goal
Compute the next '''11''' elements of the sequence.
;Reference
[https://oeis.org/A000945 OEIS sequence A000945]
<br><br>