GCDSteps - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Student[Basics]

  

GCDSteps

  

generate steps for calculating the Greatest Common Divisor (Greatest Common Factor)

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

GCDSteps( expr )

GCDSteps( expr, implicitmultiply = true )

Parameters

expr

-

list of integers or strings, sequence of integers, or an expression that contains %gcd(...)

Euclid

-

(optional) truefalse to control whether the GCD will be calculated through Euclidean Algorithm (prime factorization is default)

implicitmultiply

-

(optional) truefalse

output = ...

-

(optional) option to control the return value

displaystyle = ...

-

(optional) option to control the layout of the steps

Description

• 

The GCDSteps command accepts a list or sequence of integers, or an expression that contains %gcd, and gives steps for calculating the Greatest Common Divisor (Greatest Common Factor). By default it gives steps to get GCD by doing prime factorization, but has the option to calculate it through the full Euclidean Algorithm if the optional parameter Euclid=true is given.

• 

If the GCD is calculated through the Euclidean Algorithm, then the GCD will be the second-to-last element in the remainder column (r). In the same row as that entry, the values for s and t satisfy sa + tb = gcd(a, b), where a is the larger of the two values (the first value in the remainder row).

• 

When expr is a list, one or more elements of the list can be given as a string. In this case, the string is parsed into an expression using InertForm:-Parse so that no automatic simplifications are applied, and thus no steps are missed.

• 

The implicitmultiply option is only relevant when expr is a list of strings.  This option is passed directly on to the InertForm:-Parse command and will cause things like 2x to be interpreted as 2*x, but also, xyz to be interpreted as x*y*z.

• 

The output and displaystyle options are described in Student:-Basics:-OutputStepsRecord. The return value is controlled by the output option.  

• 

This function is part of the Student:-Basics package.

Examples

withStudent:-Basics:

GCDSteps12,3,4

GCD12,3,4Prime factorize each term:12=2233=34=22Find the factors that are present in all terms1

(1)

GCDSteps58,34,Euclid=true

GCD58,34Do Euclidean Algorithm onGCD58,34qrst05810034011241−1110−12243−522−71220//The GCD is the second-to-last element in the second column2

(2)

GCDStepsgcd(348, 234) + gcd(4, 16) + 2

gcd348,234+gcd4,16+2Exmaine termgcd348,234Prime factorize each term:348=22329234=23213Find the factors that are present in all terms23Simplify6This gives:6+gcd4,16+2Exmaine termgcd4,16Prime factorize each term:4=2216=24Find the factors that are present in all terms22Simplify4This gives:6+4+2Simplify12

(3)

Compatibility

• 

The Student:-Basics:-GCDSteps command was introduced in Maple 2024.

• 

For more information on Maple 2024 changes, see Updates in Maple 2024.

See Also

igcd

igcdex

Student:-Basics

Student:-Basics:-FactorSteps

Student:-Basics:-LCMSteps