Function reference · Algebra

pfactor

Returns the prime factors of a positive integer, smallest first, with repeats.

To get each prime with its count instead, use pfactord. For polynomials, use factor.

Notation

pfactor(value)

Write it in an expression: nerdamer('pfactor(100)'), or in the Playground.

nerdamer.pfactor

nerdamer.pfactor(value: ExpressionInput): Vector

A method on the default import. Arguments can be strings, as in Notation.

import { pfactor }

import { pfactor } from 'nerdamer/algebra';
pfactor(value: ExpressionInput): Vector

Import only this function, from nerdamer/algebra.

Parameters

value
Positive integer to prime-factor.

Examples

100 is 2·2·5·5.

pfactor(100)
// → [2, 2, 5, 5]
Open in Playground

1 has no prime factors.

pfactor(1)
// → []
Open in Playground

← Back to Function reference