group-factors ( n -- seq )


Vocabulary
math.primes.factors

Inputs and outputs
na positive integer
seqa sequence


Word description
Return a sequence of pairs representing each prime factor in the number and its corresponding power (multiplicity).

Examples
USING: math.primes.factors prettyprint ; 300 group-factors .
{ { 2 2 } { 3 1 } { 5 2 } }


See also
divisors, factors, unique-factors

Definition
USING: arrays kernel math.primes math.primes.factors.private ;

IN: math.primes.factors

: group-factors ( n -- seq )
dup prime? [ 1 2array 1array ] [ (group-factors) ] if ;
flushable