IsPeriod - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


StringTools

  

IsPeriod

  

test whether a number is a period of a word

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

IsPeriod( w, p )

Parameters

w

-

Maple string

p

-

positive integer; candidate period of w

Description

• 

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.

Examples

> 

with⁡StringTools&colon;

> 

IsPeriod⁡abc&comma;1

false

(1)
> 

IsPeriod⁡abc&comma;2

false

(2)
> 

IsPeriod⁡abc&comma;3

true

(3)
> 

IsPeriod⁡abababa&comma;1

false

(4)
> 

IsPeriod⁡abababa&comma;2

true

(5)
> 

IsPeriod⁡abababa&comma;3

false

(6)
> 

IsPeriod⁡abababa&comma;4

true

(7)
> 

IsPeriod⁡abababa&comma;5

false

(8)
> 

IsPeriod⁡abababa&comma;6

true

(9)
> 

IsPeriod⁡abababa&comma;7

true

(10)
> 

select⁡curry⁡IsPeriod&comma;babbababbabbababbabbabab&comma;`$`⁡1..24

8&comma;16&comma;21&comma;23&comma;24

(11)

See Also

curry

select

string

StringTools

StringTools[Period]