Description Usage Arguments Value References Examples
Integer factorization by trial division is the most inefficient algorithm for decomposing a composite number. Trial division is the method of testing if n is divisible by a smaller number, beginning with 2 and proceeding upwards. This order is used to eliminate the need to test for multiples of 2 and 3. Also, the trial factors never need to go further than the square root of n, √{n}, due to the fact that if n has a factor, there exists a factor f ≤q √{n}.
1 | factor_trial(n)
|
n |
Integer to be factored into product of smaller integers. |
Vector containing the factors of n should they exist. If n is prime, the returned list will only contain n.
Trial division. (2017, April 30). In Wikipedia, The Free Encyclopedia. From https://en.wikipedia.org/w/index.php?title=Trial_division&oldid=778023614
1 2 | factor_trial(9)
factor_trial(121)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.