StringTools - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Combinatorics on Words : StringTools/Period

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<=lengthsp, one has si=si+p. The least period of the string s is called the period of s.

Examples

withStringTools&colon;

Periodaaa

1

(1)

Periodabcde

5

(2)

Periodabcabc

3

(3)

Periodabcabcab

3

(4)

seqPeriodFibonaccin&comma;n&equals;1..10

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

(5)

seqcombinat&apos;fibonacci&apos;n&comma;n&equals;1..10

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

(6)

seqPeriodThueMorsen&comma;n&equals;1..10

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

(7)

`Periodic?`w&rarr;evalbPeriodwfloorlengthw2

Periodic?wevalbStringTools:−Periodwlengthw2

(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]