RosettaCodeData/Task/Primorial-numbers/00-TASK.txt
2023-07-01 13:44:08 -04:00

50 lines
2.2 KiB
Text

Primorial numbers are those formed by multiplying successive prime numbers.
The primorial number series is:
::*   primorial(0) =         1       (by definition)
::*   primorial(1) =         2       (2)
::*   primorial(2) =         6       (2×3)
::*   primorial(3) =       30       (2×3×5)
::*   primorial(4) =     210       (2×3×5×7)
::*   primorial(5) =   2310       (2×3×5×7×11)
::*   primorial(6) = 30030       (2×3×5×7×11×13)
:;* &nbsp; &nbsp; &nbsp; &nbsp; <big><b>∙ ∙ ∙</b></big>
To express this mathematically, &nbsp; '''primorial<sub><big>''n''</big></sub>''' &nbsp; is &nbsp;
the product of the first &nbsp; <big>''n''</big> &nbsp; (successive) primes:
<big><big><big>
: &nbsp; <math>primorial_n = \prod_{k=1}^n prime_k</math>
</big></big>
:::::: ─── where &nbsp; <big><big><math>prime_k</math></big></big> &nbsp; is the &nbsp; <big><big>''k''<sup>''th''</sup>''</big></big> &nbsp; prime number.
</big>
In some sense, generating primorial numbers is similar to factorials.
As with factorials, primorial numbers get large quickly.
;Task:
* &nbsp; Show the first ten primorial numbers &nbsp; (0 ──► 9, &nbsp; inclusive).
* &nbsp; Show the length of primorial numbers whose index is: &nbsp; 10 &nbsp; 100 &nbsp; 1,000 &nbsp; 10,000 &nbsp; and &nbsp; 100,000.
* &nbsp; Show the length of the one millionth primorial number &nbsp; (optional).
* &nbsp; Use exact integers, not approximations.
By &nbsp; ''length'' &nbsp; (above), it is meant the number of decimal digits in the numbers. <br>
;Related tasks:
* &nbsp; [[Sequence of primorial primes]]
* &nbsp; [[Factorial]]
* &nbsp; [[Fortunate_numbers]]
;See also:
* &nbsp; the MathWorld webpage: &nbsp; [http://mathworld.wolfram.com/Primorial.html primorial]
* &nbsp; the Wikipedia &nbsp; webpage: &nbsp; [[wp:Primorial|primorial]].
* &nbsp; the &nbsp; OEIS &nbsp; webpage: &nbsp; [[oeis:A002110|A002110]].
<br><br>