Posts

Showing posts with the label primorial numbers

Primorial numbers | Rosetta Code | #11

URL to the problem page:  http://rosettacode.org/wiki/Primorial_numbers 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) ∙ ∙ ∙  To express this mathematically, primorial n  is the product of the first n (successive) primes. In some sense, generating primorial numbers is similar to factorials. As with factorials, primorial numbers get large quickly. Show the first ten primorial numbers (0 ──► 9, inclusive). #include   <iostream> using   namespace   std ; int   main () {      int   primorial [ 100 ], cnt =  1 , cnt2;      primorial [ 0 ] =  1 ;   ...
My photo
Ercan Tomac
instagram.com/ercantomac