StringTools
IsPrimitive
test whether a string is primitive
Calling Sequence
Parameters
Description
Examples
IsPrimitive( s )
s
-
string
The IsPrimitive(s) command returns the value true if s is primitive, and the value false otherwise. A string is primitive if it cannot be written as a proper power of another string. In other words, s is primitive if Repeat⁡t,n=s implies that either s= or s=t and n=1.
All of the StringTools package commands treat strings as (null-terminated) sequences of 8-bit (ASCII) characters. Thus, there is no support for multibyte character encodings, such as unicode encodings.
with⁡StringTools:
IsPrimitive⁡
false
IsPrimitive⁡a
true
IsPrimitive⁡aaa
IsPrimitive⁡abc
IsPrimitive⁡abcabc
seq⁡IsPrimitive⁡ThueMorse⁡n,n=1..30
true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true
andmap⁡IsPrimitive,LyndonFactors⁡Random⁡1000,lower
See Also
StringTools[LyndonFactors]
StringTools[Random]
StringTools[ThueMorse]
Download Help Document