PFD: Prime Factor Decomposition (PFD)

View source: R/PFD.R

PFDR Documentation

Prime Factor Decomposition (PFD)

Description

PFD converts a positive integer to its prime-factor decomposition or *vice versa*

Usage

PFD(x)

## S3 method for class 'prime.factor.decomposition'
print(x, quote = FALSE, ...)

Arguments

x

An input vector/matrix/array (can be a vector of integers/bigz or PFDs)

quote

logical, indicating whether or not strings should be printed with surrounding quotes.

...

further arguments passed to or from other methods.

Details

This function converts a vector of integers to a corresponding character vector giving the prime-factor decomposition in a condensed form. The input can be a vector of integers or a 'bigz' vector containing large integers. In either case the function returns the corresponding vector of the prime-factor decomposition (PFD) values, written in a condensed character form. The function also converts back from the PFD form to an integer/bigz vector.

This function depends on the gmp package.

Value

If the input is integer/bigz then the output is the PFD; if the input is PFD then the output is integer/bigz

Examples

PFD(1:10)
stopifnot(all.equal(1:100, PFD(PFD(1:100))))

utilities documentation built on July 1, 2022, 9:06 a.m.

Related to PFD in utilities...