dig_root: Find the digital root of an integer

Description Usage Arguments Value References See Also Examples

Description

This function will calculate the sum of all the single-length integers [0-9] in a given integer recursively until the result is a single-length integer

Usage

1

Arguments

x

an integer

Value

the digital root of the integer

References

From Thomas Morril on Twitter:

https://twitter.com/tsmorrill/status/1028108510746226688 https://twitter.com/tsmorrill/status/1028142110342504448

See Also

dig_sum()

Examples

1
2
3
4
5
dig_root(77) # 7 + 7 = 14; 1 + 4 = 5;

# Get the multiplication table of digital roots
print(mult <- outer(1:9, 1:9))
matrix(dig_root(mult), ncol = 9, nrow = 9)

zkamvar/digroot documentation built on May 30, 2019, 6:15 p.m.