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

Online Help

All Products    Maple    MapleSim


StringTools

  

PrimitiveRoot

  

compute the primitive root of a word

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

PrimitiveRoot( w )

Parameters

w

-

Maple string

Description

• 

The PrimitiveRoot(w) command computes the primitive root of the word (string) w. The primitive root of w is the string r of minimal length for which there is a positive integer e such that w = Repeat( r, e ). That is, r is the smallest root of which w is a power.

• 

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:

> 

PrimitiveRoot⁡

(1)
> 

PrimitiveRoot⁡abc

abc

(2)
> 

PrimitiveRoot⁡abcabc

abc

(3)
> 

PrimitiveRoot⁡abcabcab

abcabcab

(4)
> 

PrimitiveRoot⁡ababab

ab

(5)
> 

PrimitiveRoot⁡abababa

abababa

(6)
> 

L≔remove⁡IsPrimitive,Generate⁡4,abc

L≔aaaa,abab,acac,baba,bbbb,bcbc,caca,cbcb,cccc

(7)
> 

L2≔map⁡PrimitiveRoot,L

L2≔a,ab,ac,ba,b,bc,ca,cb,c

(8)
> 

andmap⁡IsPrimitive,L2

true

(9)

See Also

string

StringTools

StringTools[IsPeriod]

StringTools[IsPrimitive]

StringTools[Period]

StringTools[Repeat]