factorion {FunWithNumbers} | R Documentation |
Find Factorion Numbers. ~~
Description
This function calculates the factorion value for the specified input integer. A number is a 'factorion' if it equals the sum of the factorials of its digits in a given base.
Usage
factorion(x, base = 10 , findcycle = FALSE, maxiter = 100)
Arguments
x |
The integer, or |
base |
The the base of the input integer |
findcycle |
Logical value indicating whether or not to test for cyclic values. See Details for more information. |
maxiter |
A "safety switch" to avoid possible infinite loops, terminating the function prior to convergence. Only applicable when |
Details
Most numbers are neither factorion nor part of a factorion cycle. A cycle occurs if the sequence factorion(factorion(...factorion(x)))
repeats.
Value
A list containing:
x
echoing back the input argument.
isfactorion
value 1 if x
is a factorion and 0 otherwise.
theseq
the sequence of values as each output is fed back to the input.
Author(s)
Carl Witthoft, carl@witthoft.com
References
https://en.wikipedia.org/wiki/Factorion https://oeis.org/A014080
Examples
(factorion(3,base=8,findcycle= TRUE))
# 3 6 1320 12; isit = 0
(factorion(41, base = 6))
# isit = 1