prime_factors: Prime Factors of a Number

Description Usage Arguments Value Note Examples

View source: R/factors.R

Description

The prime_factors function is used to calculate the prime factors of a positive integer greater than 1.

Usage

1

Arguments

x

The number that you want the prime factors of.

unique

Logical. Should the function return all prime factors (where prod(prime_factors(x)) == x) or just the unique prime factors? Defaults to TRUE.

Value

A numeric vector either with the repeated prime factorization of the input or just the unique prime factors of the input.

Note

Returns NULL for a value of 1, and generates an error for values less than 1.

Examples

1
2

mrdwab/mathrrr documentation built on July 20, 2020, 11:14 p.m.