Student[Basics]
GCDSteps
generate steps for calculating the Greatest Common Divisor (Greatest Common Factor)
Calling Sequence
Parameters
Description
Examples
Compatibility
GCDSteps( expr )
GCDSteps( expr, implicitmultiply = true )
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
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.
with⁡Student:-Basics:
GCDSteps⁡12,3,4
GCD⁡12,3,4•Prime factorize each term:12=22⁢33=34=22•Find the factors that are present in all terms1
GCDSteps⁡58,34,Euclid=true
GCD⁡58,34•Do Euclidean Algorithm onGCD⁡58,34qrst05810034011241−1110−12243−522−71220//•The GCD is the second-to-last element in the second column2
GCDSteps⁡gcd(348, 234) + gcd(4, 16) + 2
gcd⁡348,234+gcd⁡4,16+2•Exmaine termgcd⁡348,234•Prime factorize each term:348=22⁢3⁢29234=2⁢32⁢13•Find the factors that are present in all terms2⁢3•Simplify6•This gives:6+gcd⁡4,16+2•Exmaine termgcd⁡4,16•Prime factorize each term:4=2216=24•Find the factors that are present in all terms22•Simplify4•This gives:6+4+2•Simplify12
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
Download Help Document