Description Usage Arguments Details Value Examples
Get the Prime Factorization for a number with a particular coding.
1 | ReducePrime(code, out.summary = FALSE, primes.div = NULL)
|
code |
A vector representing a number. See details. |
out.summary |
Is the result to be summarized? For example,
(2, 3, 0, 0, 1) can be summarized as (2, 5; 3, 1). Default is |
primes.div |
The vector of all prime numbers
up to |
A code
is the coding of a number as follows,
number = ∏ i^{code[i]},
or, which is equivalent,
\log(number) = ∑ code[i] * \log(i).
For example,
5 is coded as (0, 0, 0, 0, 1),
5! is coded as (1, 1, 1, 1, 1),
8! is coded as (1, 1, 1, 1, 1, 1, 1, 1),
8! / 5! is therefore coded as (0, 0, 0, 0, 0, 1, 1, 1),
5! = 5 * 3 * 2^3 can be reduced to (0, 3, 1, 0, 1).
Note that the first element of a code
has no effect.
Two rows representing prime numbers
1 2 3 4 | code100 <- c(rep(0, 99), 1)
ReducePrime(c(rep(0, 99), 1), out.summary = TRUE)
primes.div <- AllPrimesUpTo(floor(sqrt(length(code100))))
ReducePrime(c(rep(0, 99), 1), primes.div = primes.div)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.