StringTools
IsPeriod
test whether a number is a period of a word
Calling Sequence
Parameters
Description
Examples
IsPeriod( w, p )
w
-
Maple string
p
positive integer; candidate period of w
The IsPeriod(w,p) command tests whether the positive integer p is a period of the string w. A positive integer p is said to be a period of a string s if, for all integers i with 1<=i<=length⁡s−p, one has si=si+p. If p is a period of w, then the value true is returned; otherwise, false is returned.
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:
IsPeriod⁡abc,1
false
IsPeriod⁡abc,2
IsPeriod⁡abc,3
true
IsPeriod⁡abababa,1
IsPeriod⁡abababa,2
IsPeriod⁡abababa,3
IsPeriod⁡abababa,4
IsPeriod⁡abababa,5
IsPeriod⁡abababa,6
IsPeriod⁡abababa,7
select⁡curry⁡IsPeriod,babbababbabbababbabbabab,`$`⁡1..24
8,16,21,23,24
See Also
curry
select
string
StringTools[Period]
Download Help Document