Next: print() Up: MacAnova Help File Previous: predtable()   Contents

primefactors()

Usage:
primefactors(n [, max:T]), n an integer scalar or vector



Keywords: general
primefactors(n), where n is a positive integer < 2^52 =
4503599627370496, returns a vector containing the prime factors of n,
possibly with repetitions.

When n is a vector of positive integers <= 999999999999 = 10^12 - 1,
primefactors(n) returns a structure with length(n) components.
Component i is a vector containing the prime factors of n[i] and having
the numeric value of n[i] as its name.  The reason for the smaller range
of permissible values is because a component name can have at most 12
characters.  Note:  Because the component names are numeric and not
alphabetic, you must use a subscript to extract a component.

primefactors(n,max:T), where n is a positive integer scalar or vector
with n[i] < 2^52 = 4503599627370496, returns an integer vector of the
same length as n containing the maximum prime factors of each element of
n.

Examples:
  Cmd> primefactors(64094231)
  (1)          641        99991

  Cmd> stuff <- primefactors(vector(3,15,64094231)); stuff
  component: 3
  (1)            3
  component: 15
  (1)            3            5
  component: 64094231
  (1)          641        99991

  Cmd> stuff[3] # stuff$64094231 is illegal
  (1)          641        99991

  Cmd> stuff[compnames(stuff) == "64094231"]
  (1)          641        99991

  Cmd> primefactors(64094231, max:T)
  (1)        99991

See also goodfactors().


Gary Oehlert 2003-01-15