]> gitweb.factorcode.org Git - factor.git/blob - basis/math/primes/factors/factors-docs.factor
Merge branch 'master' into experimental
[factor.git] / basis / math / primes / factors / factors-docs.factor
1 USING: help.markup help.syntax math sequences ;
2 IN: math.primes.factors
3
4 { factors group-factors unique-factors } related-words
5
6 HELP: factors
7 { $values { "n" "a positive integer" } { "seq" sequence } }
8 { $description { "Return an ordered list of a number's prime factors, possibly repeated." } }
9 { $examples { $example "USING: math.primes.factors prettyprint ;" "300 factors ." "{ 2 2 3 5 5 }" } } ;
10
11 HELP: group-factors
12 { $values { "n" "a positive integer" } { "seq" sequence } }
13 { $description { "Return a sequence of pairs representing each prime factor in the number and its corresponding power (multiplicity)." } }
14 { $examples { $example "USING: math.primes.factors prettyprint ;" "300 group-factors ." "{ { 2 2 } { 3 1 } { 5 2 } }" } } ;
15
16 HELP: unique-factors
17 { $values { "n" "a positive integer" } { "seq" sequence } }
18 { $description { "Return an ordered list of a number's unique prime factors." } }
19 { $examples { $example "USING: math.primes.factors prettyprint ;" "300 unique-factors ." "{ 2 3 5 }" } } ;
20
21 HELP: totient
22 { $values { "n" "a positive integer" } { "t" integer } }
23 { $description { "Return the number of integers between 1 and " { $snippet "n-1" } " that are relatively prime to " { $snippet "n" } "." } } ;