aliquot | R Documentation |
Each term in the aliquot sequence is generated by summing all proper divisors of the previous term. The value "1" is included in this collection of divisors. In number theory, aliquot is closely related to terms such as "sociable" and "amicable" numbers
aliquot(x, maxiter = 100)
x |
An integer or a |
maxiter |
Set a limit on the number of terms to calculate. See Details for reasons why to do so. |
While many aliquot sequences terminate in the values c(prime_number, 1, 0), many numbers drop into a short loop or a repeating value (perfect numbers do this). If the sequence repeats or terminates, the sequence is returned. If either maxiter
is reached or the sequence drops into a loop (and thus maxiter
will be triggered), a warning notice is generated and the sequence so far is returned.
A vector of bigz
integers ...
Carl Witthoft, carl@witthoft.com
aliquot(20)
# 20 22 14 10 8 7 1
aliquot (95)
# repeats '6' forever
# 95 25 6 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.