How to resolve the algorithm Primorial numbers step by step in the Quackery programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Primorial numbers step by step in the Quackery 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 Quackery programming language
Source code in the quackery programming language
[ 0 swap
[ dip 1+
10 /
dup 0 = until ]
drop ] is digits ( n --> n )
[ stack ] is primorials ( --> s )
1299710 eratosthenes
' [ 1 ]
1299710 times
[ i^ isprime if
[ i^ over -1 peek * join ] ]
primorials put
primorials share 10 split drop echo
cr
[] 6 times
[ primorials share
10 i^ ** peek
digits join ]
echo
You may also check:How to resolve the algorithm Guess the number step by step in the Pascal programming language
You may also check:How to resolve the algorithm Least common multiple step by step in the Assembly programming language
You may also check:How to resolve the algorithm Count the coins step by step in the EDSAC order code programming language
You may also check:How to resolve the algorithm Pernicious numbers step by step in the Factor programming language
You may also check:How to resolve the algorithm Return multiple values step by step in the Lily programming language