compute the period of a word - Maple 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

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&equals;si&plus;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&comma;2&comma;2&comma;3&comma;5&comma;8&comma;13&comma;21&comma;34&comma;55

(5)

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

1&comma;1&comma;2&comma;3&comma;5&comma;8&comma;13&comma;21&comma;34&comma;55

(6)

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

1&comma;2&comma;3&comma;3&comma;3&comma;5&comma;6&comma;6&comma;6&comma;6

(7)

`Periodic?`:=w&rarr;evalbPeriodwfloorlengthw2

Periodic?:=w&rarr;evalbStringTools:-Periodwfloor12lengthw

(8)

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

2&comma;17&comma;true

(9)

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

5&comma;7&comma;false

(10)

See Also

string, StringTools, StringTools[IsPeriod]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam