primitive | R Documentation |
A primitive word is one that is not of the form a^m
for
any m>1
. The concept is used in Lyndon and Schutzenberger 1962.
is.primitive(x)
is.power(d,n)
x |
Freegroup object, coerced to Tietze form |
d |
Numeric vector |
n |
Integer |
Function is.primitive()
returns a boolean vector indicating
whether the elements of its argument are primitive.
Function is.power()
is a lower-level helper function.
is.power(d,n)
determines whether d
is an n
-th power
(that is, d
may be written as n
copies of some numeric
vector).
Thus is_power(c(4,5,7,4,5,7,4,5,7,4,5,7),4)
returns TRUE
because its primary argument is indeed a fourth power (of
c(4,5,7)
).
Returns a boolean.
Robin K. S. Hankin. The code for finding the factors of an integer was (somewhat more than) inspired by the numbers package.
R. C. Lyndon and M. P. Schutzenberger 1962. “The equation
a^M=b^Nc^P
in a free group”. Michigan Mathematical Journal,
9(4): 289–298.
is.primitive(as.free(c("a","aaaa", "aaaab", "aabaab", "aabcaabcaabcaabc")))
is.power(c(7,8,4,7,8,4,7,8,4,7,8,4),4)
table(is.primitive(rfree(100)))
## primitive with >1 symbols is rare:
x <- rfree(1000)
x[!is.primitive(x) & number(x)>1]
## try x <- rfree(10000) [but this takes a long time]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.