Vocabulary/qco

From J Wiki
Jump to: navigation, search

>> <<   Down to: Dyad   Back to: Vocabulary Thru to: Dictionary

q: y Prime Factors

Rank 0 -- operates on individual atoms of y, producing a result that may require fill -- WHY IS THIS IMPORTANT?



The prime factorization of integer y, listed in ascending order.

the same as (3 p: y). See Primes (p:)

   q: 2^31
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
   q: 1+ 2^31
3 715827883
   q: 2+ 2^31
2 5 5 13 41 61 1321

Common uses

Mathematical investigations.


Related Primitives

Primes (p:)


x q: y Prime Exponents

Rank 0 0 -- operates on individual atoms of x and y, producing a result that may require fill -- WHY IS THIS IMPORTANT?



The exponents of primes in the factorization of y

an exponent of 0 means that the corresponding prime is not a factor of y

   p: i.10   NB. the first 10 primes
2 3 5 7 11 13 17 19 23 29
   q: 700    NB. prime factors of 700
2 2 5 5 7
   _ q: 700   NB. 700 = (2^2) * (3^0) * (5^2) * (7^1)
2 0 2 1
   __ q: 700
2 5 7
2 2 1

The rank of the result, and the values listed, depend on x

x Result

Rank

Meaning of Results Number of Primes Zero exponents included?
positive 1 The leading exponents of the prime factorization (keeping primes in ascending order) x (x=_ means "up through the last nonzero exponent") yes
negative 2 Second row: The trailing exponents of the prime factorization (keeping primes in ascending order) |x (x=__ means "all nonzero exponents") no
First row: the corresponding primes

Common uses

1. Calculate the number of divisors of a number

   */ >: _ q: 17
2
   */ >: _ q: 60
12

More Information

1. When x is negative:

  • the table t =. primes,:exponents is calculated, including primes with 0 exponents, ending with the largest prime with a nonzero exponent;
  • The last (|x)<.({:$t) columns of t are selected (i. e. the last |x columns, but no more columns than exist in t);
  • Columns with 0 exponents are then deleted.

Because the zero exponents are deleted at the last step, the result of  x q: y is not the same as that of  x {. __ q: y .

   _3 q: 2*3*5*17
17
 1

2.  __ q: y is equivalent to  2 p: y .


Related Primitives

Primes (p:)


Details

1. The result has integer or extended-integer precision, depending on the size of the largest prime factor.