Learn R Programming

pnf (version 0.1.1)

pnf: Integer Factorization

Description

Given a positive integer m (or an object that can be coerced to an integer), returns NA if m is one or a prime number, and returns the smallest integer factor (excluding one) otherwise.

Usage

pnf (m)

Arguments

m
A positive integer.

Examples

Run this code
#find the smallest factor of the number 187
pnf (187)

Run the code above in your browser using DataLab