HCF & LCM of Two Numbers by Prime Factorization by Ronan Downes
Loading the math board and drawing, please wait…
This example demonstrates how to find the highest common factor (HCF) and least common multiple (LCM) of two numbers using prime factorization. Key mathematical concepts include prime factorization, HCF, and LCM. GeoGebra commands used include Unique, Factors, Sort, Zip, KeepIf, Textfield, and LaTeX. Suitable for middle school and above students to learn number theory.
GeoGebra Commands & Parameters
Unique(PrimeFactors[b]) → listBFactors(b) → M2Unique(PrimeFactors[a]) → listASort(Union[listA, listB]) → listPrimeZip(If[Defined[IndexOf[k, listB]], Element[M2, IndexOf[k, listB], 2], 0], k, listPrime) → listB2Factors(a) → M1Zip(If[Defined[IndexOf[k, listA]], Element[M1, IndexOf[k, listA], 2], 0], k, listPrime) → listA2Zip({k, Min[m, n]}, k, listPrime, m, listA2, n, listB2) → listHCFKeepIf(Element[k, 2] ≠ 0, k, listHCF) → listHCF'Zip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[M1], UnicodeToLetter[8901], ""]), p, M1) → listTextATextfield(a) → inputBox1LaTeX("=" + (Sum[listTextA])) → textAZip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[M2], UnicodeToLetter[8901], ""]), p, M2) → listTextBLaTeX("=" + (Sum[listTextB])) → textBTextfield(b) → inputBox2Zip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[listHCF'], UnicodeToLetter[8901], ""]), p, listHCF') → listTextHCFZip({k, Max[m, n]}, k, listPrime, m, listA2, n, listB2) → listLCMZip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[listLCM], UnicodeToLetter[8901], ""]), p, listLCM) → listTextLCMLaTeX("\text{HCF= }" + (If[listHCF' ≟ {}, "1", Sum[listTextHCF]])) → textHCFLaTeX("\text{LCM= }" + (Sum[listTextLCM])) → textLCM
AI Drawing Prompt Reference
Draw a graphic that shows prime factorization of two numbers, including lists of prime factors and the HCF and LCM calculated from them. The graphic should clearly display the factorization process and label the HCF and LCM results.
The prompt above was compiled from the original drawing commands and is for reference only.