How to resolve the algorithm Primorial numbers step by step in the Arturo programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Primorial numbers step by step in the Arturo programming language
Table of Contents
Problem Statement
Primorial numbers are those formed by multiplying successive prime numbers.
The primorial number series is: To express this mathematically, primorialn 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.
By length (above), it is meant the number of decimal digits in the numbers.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Primorial numbers step by step in the Arturo programming language
Source code in the arturo programming language
primes: [2] ++ select.first: 99999 range.step: 2 3 ∞ => prime?
primorial: function [n][
if 0 = n -> return 1
product take primes n
]
print "First ten primorials:"
loop 0..9 => [print primorial &]
print ""
loop 1..5 'm -> print [
"primorial" 10^m "has" size ~"|primorial 10^m|" "digits"
]
You may also check:How to resolve the algorithm Animation step by step in the Clojure programming language
You may also check:How to resolve the algorithm Operator precedence step by step in the 11l programming language
You may also check:How to resolve the algorithm GUI component interaction step by step in the PowerShell programming language
You may also check:How to resolve the algorithm Write entire file step by step in the Arturo programming language
You may also check:How to resolve the algorithm Sorting algorithms/Radix sort step by step in the Python programming language