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

Online Help

All Products    Maple    MapleSim


StringTools

  

Period

  

compute the period of a word

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Period( w )

Parameters

w

-

Maple string

Description

• 

The Period(w) command computes the period of a string (word) 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. The least period of the string s is called the period of s.

• 

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;

> 

Period⁡aaa

1

(1)
> 

Period⁡abcde

5

(2)
> 

Period⁡abcabc

3

(3)
> 

Period⁡abcabcab

3

(4)
> 

seq⁡Period⁡Fibonacci⁡n&comma;n=1..10

1,2,2,3,5,8,13,21,34,55

(5)
> 

seq⁡combinatfibonacci⁡n&comma;n=1..10

1,1,2,3,5,8,13,21,34,55

(6)
> 

seq⁡Period⁡ThueMorse⁡n&comma;n=1..10

1,2,3,3,3,5,6,6,6,6

(7)
> 

`Periodic?`≔w↦evalb⁡Period⁡w≤floor⁡length⁡w2

Periodic?≔w↦evalb⁡StringTools:−Period⁡w≤length⁡w2

(8)
> 

Period&comma;length&comma;`Periodic?`⁡ababababababababa

2,17,true

(9)
> 

Period&comma;length&comma;`Periodic?`⁡abcdeab

5,7,false

(10)

See Also

string

StringTools

StringTools[IsPeriod]