Loading ...
Sorry, an error occurred while loading the content.

Another easy PARI question

Expand Messages
  • Roahn Wynar
    Sorry bout this but I just can t find some obvious things in the PARI manual, I hope I didn t miss it... Anyway: the easy instruction factor(N) yeilds a
    Message 1 of 2 , Jul 8, 2006
    • 0 Attachment
      Sorry 'bout this but I just can't find some obvious things in the PARI manual, I hope I didn't miss it...

      Anyway: the easy instruction "factor(N)" yeilds a matrix. What function will tell me just the length and width of the matrix? The length should always be 2 but the width will be the number of different factors.

      Thanks in advance,
      Roahn

      [Non-text portions of this message have been removed]
    • Peter Kosinar
      ... The factor(N) function returns a matrix with W rows, where W is the number of distinct prime factors of N and each row consists of two elements -- the
      Message 2 of 2 , Jul 8, 2006
      • 0 Attachment
        > Sorry 'bout this but I just can't find some obvious things in the PARI
        > manual, I hope I didn't miss it...
        >
        > Anyway: the easy instruction "factor(N)" yeilds a matrix. What function
        > will tell me just the length and width of the matrix? The length should
        > always be 2 but the width will be the number of different factors.

        The factor(N) function returns a matrix with W rows, where W is the number
        of distinct prime factors of N and each row consists of two elements --
        the prime and its exponent in factorization of N. W itself can be found
        using the function omega(N).

        However, if you have already computed the factorization of N, it might be
        much faster to use matsize(A) function, which returns the dimensions of
        matrix A as a two-element vector (so that you can use matsize(A)[1] or
        matsize(A)[2] to get your "width" and "length").

        Peter

        --
        [Name] Peter Kosinar [Quote] 2B | ~2B = exp(i*PI) [ICQ] 134813278
      Your message has been successfully submitted and would be delivered to recipients shortly.