Breadcrumbs

 

 

 

Download ModelDownload SourceembedLaunch Website ES WebEJS

Translations

Code Language Translator Run

Credits

weelookang@gmail.com; Francisco Esquembre; Felix J. Garcia Clemente

Overview:

This document provides a briefing on the "Greatest common divisor (gcd) of two integers HTML5" resource available on the Open Educational Resources / Open Source Physics @ Singapore website. This resource offers an interactive HTML5 simulation designed to help users understand and calculate the greatest common divisor (GCD) of two integers. The page also provides mathematical and computational solutions for finding the GCD, credits the developers, and lists numerous other educational resources available on the platform.

2. Main Themes and Important Ideas/Facts:

  • Definition and Mathematical Solution of GCD: The resource clearly defines the greatest common divisor (gcd(x,y)) as the largest positive integer that divides both x and y without leaving a remainder. It presents the Euclidean algorithm as a method for finding the GCD:
  • Key Idea: "If two numbers, x and y are given, the greatest common divisor of x and y, denoted by gcd(x,y) can be found by reducing the numbers to smaller numbers using the following mathematics results: gcd(x,y) = gcd(y,x%y)."
  • Example: The document provides a clear example: "Hence, gcd(34, 8) = gcd(8, 2) = gcd(2,0) = 2". This demonstrates the iterative reduction process of the Euclidean algorithm.
  • Interactive HTML5 Simulation: The core of the resource is an embeddable HTML5 simulation that allows users to explore the concept of GCD visually and interactively.
  • Embed Code: The page provides an iframe code snippet to easily integrate the simulation into other web pages:
  • <iframe width="100%" height="100%" src="https://iwant2study.org/lookangejss/math/ejss_model_GreaterCommonDivisor/GreaterCommonDivisor_Simulation.xhtml " frameborder="0"></iframe>
  • Computational Solution (JavaScript): For educators and those interested in the underlying implementation, the resource provides a JavaScript function to calculate the GCD of two numbers.
  • Algorithm: The JavaScript code implements the Euclidean algorithm using a while loop and the modulo operator (%).
  • Input Validation: The function includes basic input validation to ensure that the inputs x and y are numbers.
  • Absolute Values: The code uses Math.abs() to handle negative input values, ensuring the algorithm works correctly for all integers.
  • Code Snippet:function gcd_two_numbers(x, y) { //using 34,8 as example
  • if ((typeof x !== 'number') || (typeof y !== 'number'))
  • return false;
  • x = Math.abs(x);
  • y = Math.abs(y);
  • while(y>0) { // do this while y is greater than 0, in other words remainder of x%y is non-zero
  • var t = y; //dummy t variable
  • y = x % y; // 34%8 assign y =2 y= 8%2 = 0 y =2 y =0
  • x = t; // assign t back to x x=2 x=8 x= 2
  • }
  • return x; // return as output when the algorithm stops
  • }
  • Context within a Larger Educational Resource: The GCD resource is part of a broader collection of open educational resources focused on science and mathematics, hosted by Open Source Physics @ Singapore. This is evident from the website's structure, breadcrumbs, and the extensive list of "Other Resources."
  • Focus on Interactive Learning: The inclusion of the HTML5 simulation highlights a pedagogical approach that emphasizes active learning and the use of technology to visualize abstract mathematical concepts. The platform also promotes the use of "interactive simulations" as seen in the breadcrumbs referencing a conference booth.
  • Attribution and Licensing: The resource provides clear credits to Francisco Esquembre and Felix J. Garcia Clemente. It also states that the "Contents are licensed Creative Commons Attribution-Share Alike 4.0 Singapore License," promoting open access and sharing of educational materials. Commercial use of the underlying "EasyJavaScriptSimulations Library" requires a separate license.
  • Variety of Other Educational Tools: The extensive list under the "end faq" section showcases a vast range of interactive simulations and resources covering various topics in mathematics and physics. These include topics like oscillations, waves, mechanics, electricity and magnetism, calculus, and more, often utilizing JavaScript and HTML5. The titles frequently mention "PICUP" (Partnership for Integration of Computation into Undergraduate Physics), suggesting a focus on computational physics education.
  • Integration with Learning Management Systems: The mention of "SLS MOE Calendar Planner" and the "20250311 EdTech NLC YIJC Kinematics Quiz conversion from DOC/PDF to SLS components using Interactive Response and ACP Enhancing Student Learning with an Interactive Distance-Time Graph Simulation" indicates an effort to integrate these interactive tools with national learning platforms.
  • AI in Content Creation: Notably, some of the listed resources mention being "created using AI GPTo1" or "using Google Gemini Thinking Model," indicating the platform's exploration of artificial intelligence in the development of educational materials.

3. Key Quotes:

  • Mathematical Solution: "If two numbers, x and y are given, the greatest common divisor of x and y, denoted by gcd(x,y) can be found by reducing the numbers to smaller numbers using the following mathematics results: gcd(x,y) = gcd(y,x%y)."
  • Computational Solution (Loop Condition): "while(y>0) { // do this while y is greater than 0, in other words remainder of x%y is non-zero"
  • Licensing: "Contents are licensed Creative Commons Attribution-Share Alike 4.0 Singapore License."

4. Conclusion:

The "Greatest common divisor (gcd) of two integers HTML5" resource is a valuable tool for teaching and learning about the GCD. It effectively combines a clear explanation of the mathematical concept with an interactive simulation and a computational implementation. Its presence within a large and diverse collection of open educational resources highlights the platform's commitment to leveraging technology, particularly HTML5 and JavaScript, to enhance science and mathematics education. The increasing mention of AI in content creation suggests a future direction for the platform's development. Educators can readily embed the GCD simulation into their online learning materials using the provided iframe code. The clear licensing terms also facilitate the sharing and adaptation of these resources.

 

 

Study Guide: Greatest Common Divisor (GCD)

Key Concepts

  • Greatest Common Divisor (GCD): The largest positive integer that divides two or more integers without leaving a remainder. It is also known as the greatest common factor (GCF) or highest common factor (HCF).
  • Modulo Operator (%): An arithmetic operator that returns the remainder of a division operation. For example, x % y gives the remainder when x is divided by y.
  • Euclidean Algorithm: An efficient method for computing the GCD of two integers. The core principle is based on the property gcd(x, y) = gcd(y, x % y).
  • Recursive Application: The mathematical solution presented uses a recursive approach, where the GCD problem is reduced to a simpler GCD problem until the remainder becomes zero.
  • Iterative Approach: The computing solution demonstrates an iterative approach using a while loop to repeatedly apply the modulo operation until the remainder is zero.
  • Function Definition: The provided JavaScript code defines a function gcd_two_numbers(x, y) that takes two numbers as input and returns their GCD.
  • Input Validation: The computing solution includes a check to ensure that both inputs x and y are numbers before proceeding with the calculation.
  • Absolute Value: The computing solution takes the absolute value of the input numbers to ensure that the algorithm works correctly for both positive and negative integers.

Quiz

  1. Explain the definition of the greatest common divisor (GCD) of two integers in your own words. Provide a simple example to illustrate your explanation.
  2. Describe the fundamental mathematical property that forms the basis of the Euclidean Algorithm for finding the GCD of two numbers, x and y.
  3. Using the mathematical solution provided, demonstrate the steps to find the gcd(48, 18). Show each application of the formula gcd(x,y) = gcd(y,x%y).
  4. In the provided computing solution (JavaScript), what is the purpose of the while(y>0) loop? Explain the condition under which the loop continues to execute.
  5. Trace the execution of the gcd_two_numbers(34, 8) function as shown in the computing solution. List the values of y and x at each step within the loop.
  6. What is the role of the variable t in the computing solution? Why is it necessary in the process of calculating the GCD iteratively?
  7. Explain why the computing solution includes the lines x = Math.abs(x); and y = Math.abs(y);. Why is it important to handle potential negative inputs?
  8. Compare and contrast the mathematical solution and the computing solution provided in terms of their approach to finding the GCD. What are the key differences?
  9. The webpage mentions "Sample Learning Goals Mathematical solution" and "For Teachers Computing Solution." What might be a reason for presenting these as distinct approaches?
  10. Beyond finding the GCD itself, what broader mathematical or computational concepts might learners encounter and understand through studying this material and the interactive simulation mentioned?

Quiz Answer Key

  1. The GCD is the largest positive whole number that divides two given numbers exactly, without leaving any remainder. For example, the GCD of 6 and 9 is 3, because 3 is the largest number that divides both 6 (6 ÷ 3 = 2) and 9 (9 ÷ 3 = 3) without a remainder.
  2. The Euclidean Algorithm is based on the principle that the greatest common divisor of two numbers does not change if the larger number is replaced by its remainder when divided by the smaller number. This can be expressed as gcd(x, y) = gcd(y, x % y).
  3. gcd(48, 18) = gcd(18, 48 % 18) = gcd(18, 12) gcd(18, 12) = gcd(12, 18 % 12) = gcd(12, 6) gcd(12, 6) = gcd(6, 12 % 6) = gcd(6, 0) Therefore, gcd(48, 18) = 6.
  4. The while(y>0) loop continues to execute as long as the value of y is greater than zero. In the context of the Euclidean Algorithm, y represents the remainder of the division. The loop stops when the remainder becomes zero, indicating that the previous value of x is the GCD.
  5. Iteration 1: t = 8, y = 34 % 8 = 2, x = 8 Iteration 2: t = 2, y = 8 % 2 = 0, x = 2 The loop terminates.
  6. The variable t acts as a temporary placeholder to store the current value of y before y is updated with the remainder (x % y). This is necessary so that the old value of y can then be assigned to x in the same iteration, effectively swapping the roles of the numbers for the next step of the Euclidean Algorithm.
  7. The lines x = Math.abs(x); and y = Math.abs(y); are included to handle cases where the input numbers might be negative. The GCD is always a positive integer, and the Euclidean Algorithm works correctly with non-negative integers. Taking the absolute value ensures that the algorithm proceeds with positive values.
  8. The mathematical solution demonstrates the core recursive principle of the Euclidean Algorithm by repeatedly applying the gcd(x,y) = gcd(y,x%y) formula until a base case (remainder of 0) is reached. The computing solution implements this logic iteratively using a while loop and temporary variable to achieve the same result.
  9. The "Mathematical solution" provides a concise and abstract representation of the algorithm, focusing on the mathematical relationship between the GCD of successive pairs of numbers. The "Computing Solution" offers a concrete, step-by-step implementation in a programming language, which is necessary for a computer to execute the algorithm and may be more directly useful for teachers demonstrating how to code the GCD calculation.
  10. Learners might encounter and understand concepts such as algorithms (a set of well-defined instructions), recursion (a problem-solving technique where the solution depends on solutions to smaller instances of the same problem), iteration (repeated execution of a block of code), modular arithmetic (working with remainders), function definition and usage in programming, and the translation of a mathematical concept into a computational process. The interactive simulation would further enhance understanding through visual representation and experimentation.

Essay Format Questions

  1. Discuss the Euclidean Algorithm as an efficient method for finding the greatest common divisor of two integers. Explain the mathematical principle behind the algorithm and compare its efficiency to other potential methods.
  2. Analyze the provided JavaScript code for calculating the GCD of two numbers. Explain the purpose of each step in the code and discuss how it effectively implements the Euclidean Algorithm in an iterative manner.
  3. Consider the distinction made in the source between the "Mathematical solution" and the "Computing Solution" for finding the GCD. Why is it valuable to understand both the mathematical theory and its practical implementation in programming?
  4. Explore the potential pedagogical benefits of using interactive simulations, such as the one linked in the source, for teaching mathematical concepts like the greatest common divisor. How can such tools enhance student understanding and engagement?
  5. The concept of the greatest common divisor has applications in various areas of mathematics and computer science. Discuss some of these applications, providing examples where the GCD plays a significant role.

Glossary of Key Terms

  • Algorithm: A well-defined sequence of instructions, typically to solve a problem or perform a computation.
  • Base Case: In a recursive algorithm, the condition under which the recursion stops and a direct result is returned. In the GCD mathematical solution, the base case is when the remainder is 0.
  • Euclidean Algorithm: An efficient algorithm for finding the greatest common divisor (GCD) of two integers.
  • Greatest Common Divisor (GCD): The largest positive integer that divides two or more integers without leaving a remainder.
  • Iterative Process: A method of solving a problem by repeating a set of instructions until a specific condition is met. The computing solution uses a while loop for iteration.
  • Modulo Operation: An arithmetic operation denoted by the symbol % that calculates the remainder of a division.
  • Recursion: A method of solving a problem where the solution depends on solutions to smaller instances of the same problem. The mathematical solution for GCD demonstrates recursion.

Sample Learning Goals Mathematical solution:

If two numbers, x and y are given, the greatest common divisor of x and y, denoted by gcd(x,y) can be found by reducing the numbers to smaller numbers using the following mathematics results

gcd(x,y) = gcd(y,x%y).
Hence, gcd(34, 8) = gcd(8, 2) = gcd(2,0) = 2

For Teachers Computing Solution

function gcd_two_numbers(x, y) { //using 34,8 as example
if ((typeof x !== 'number') || (typeof y !== 'number'))
return false;
x = Math.abs(x);
y = Math.abs(y);
while(y>0) {  // do this while y is greater than 0, in other words remainder of x%y is non-zero 
var t = y; //dummy t variable
y = x % y; // 34%8 assign y =2 y= 8%2 = 0 y =2 y =0 

x = t; // assign t back to x x=2 x=8 x= 2
}
return x;  //  return as output when the algorithm stops


}

Research

[text]

Video

[text]

 Version:

Other Resources

[text]

Frequently Asked Questions

What is the Greatest Common Divisor (GCD)?

The greatest common divisor (GCD) of two integers, x and y, is the largest positive integer that divides both x and y without leaving a remainder. It is denoted as gcd(x, y).

How can the GCD of two numbers be found mathematically?

The GCD of two numbers can be found using the Euclidean algorithm, which is based on the principle that gcd(x, y) = gcd(y, x % y), where '%' represents the modulo operation (the remainder of the division). This process is repeated until the remainder is 0. The GCD is the last non-zero remainder. For example, gcd(34, 8) = gcd(8, 34 % 8) = gcd(8, 2) = gcd(2, 8 % 2) = gcd(2, 0) = 2.

How can the GCD of two numbers be calculated using a computing solution?

A computational approach to finding the GCD involves using a loop that continues as long as the second number (y) is greater than 0. Inside the loop, the value of y is temporarily stored, y is updated to the remainder of x divided by y (x % y), and then x is updated to the temporarily stored value of y. When the loop terminates (y becomes 0), the GCD is the final value of x. The provided JavaScript function gcd_two_numbers(x, y) demonstrates this algorithm.

What is the purpose of the provided HTML5 simulation?

The HTML5 simulation, embedded via an iframe, is an interactive tool designed to help users understand and visualize the concept of the Greatest Common Divisor of two integers. It likely allows users to input different numbers and observe the process of finding their GCD, potentially illustrating either the mathematical or the computational method.

What are Open Educational Resources (OER)?

Open Educational Resources (OER) are teaching, learning, and research materials that are freely available for anyone to use, adapt, and share. The "@ Singapore | Open Educational Resources / Open Source Physics @ Singapore" designation indicates that this resource is part of an initiative to provide such materials in mathematics and physics, promoting open access to educational content.

What is Easy JavaScript Simulations (EJS)?

Easy JavaScript Simulations (EJS) is a tool or library that facilitates the creation of interactive simulations, likely using JavaScript and HTML5. The numerous listed simulations covering a wide range of topics in mathematics and physics suggest that EJS is a key technology behind the interactive models provided by this platform. Its mention in the commercial use license further highlights its role in the development of these resources.

What types of interactive simulations are available on this platform?

The platform hosts a vast collection of interactive simulations covering diverse topics in mathematics and physics. These include concepts from algebra (like geometric sequences), calculus (integrals, derivatives), mechanics (projectile motion, oscillations), waves, electricity and magnetism, thermal physics, optics, and even games and puzzles with a mathematical or physical basis. Many simulations are identified as being created with JavaScript and HTML5, often under the PICUP (Partnership for Integration of Computation into Undergraduate Physics) project.

Who are the contributors and what are the licensing terms for these resources?

The credits for the GCD simulation mention Francisco Esquembre and Felix J. Garcia Clemente. The platform as a whole is managed by "Open Educational Resources / Open Source Physics @ Singapore." The contents are licensed under the Creative Commons Attribution-Share Alike 4.0 Singapore License, which allows for sharing and adaptation with proper attribution and under the same license. Commercial use of the EasyJavaScriptSimulations Library requires a separate license obtained by contacting fem@um.es.

1 1 1 1 1 1 1 1 1 1 Rating 0.00 (0 Votes)