HCF & LCM of Three Numbers via Prime Factorization
Loading the math board and drawing, please wait…
① This example demonstrates how to obtain the highest common factor (HCF) and lowest common multiple (LCM) of three integers simultaneously using prime factorization. ② Core mathematical concepts include prime factorization, HCF, LCM, set operations (intersection, union) and product computation. ③ Construction highlights: GeoGebra commands Factors for factorization, Unique for deduplication, Sort for ordering, Zip to combine lists, KeepIf to filter common factors, Product for multiplication, If for conditional logic, Textfield and LaTeX for output, together with input boxes (inputBox1‑3), a button (button0) and a language‑switch button (buttonLang) for interaction. ④ Suitable for middle‑school number‑theory lessons, high‑school review, self‑study, and as a list‑processing illustration in programming education.
GeoGebra Commands & Parameters
Factors(b) → M2Unique(PrimeFactors[b]) → listBFactors(a) → M1Unique(PrimeFactors[a]) → listAFactors(c) → M3Unique(PrimeFactors[c]) → listCSort(Union[Union[listA, listB], listC]) → listPrimeZip(If[Defined[IndexOf[k, listB]], Element[M2, IndexOf[k, listB], 2], 0], k, listPrime) → listB2Zip(If[Defined[IndexOf[k, listC]], Element[M3, IndexOf[k, listC], 2], 0], k, listPrime) → listC2Zip(If[Defined[IndexOf[k, listA]], Element[M1, IndexOf[k, listA], 2], 0], k, listPrime) → listA2Zip({k, Min[{m, n, p}]}, k, listPrime, m, listA2, n, listB2, p, listC2) → listHCFKeepIf(Element[k, 2] ≠ 0, k, listHCF) → listHCF'Product(Zip[Element[k, 1]^(Element[k, 2]), k, listHCF']) → resultHCFIf(listHCF' ≟ {}, 1, resultHCF) → resultHCF'Zip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[M1], UnicodeToLetter[8901], ""]), p, M1) → listTextATextfield(a) → inputBox1Zip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[M2], UnicodeToLetter[8901], ""]), p, M2) → listTextBTextfield(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, p}]}, k, listPrime, m, listA2, n, listB2, p, listC2) → listLCMZip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[listLCM], UnicodeToLetter[8901], ""]), p, listLCM) → listTextLCMLaTeX("\text{LCM= }" + (Sum[listTextLCM])) → textLCMTextfield(c) → inputBox3Zip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[M3], UnicodeToLetter[8901], ""]), p, M3) → listTextCProduct(Zip[Element[k, 1]^(Element[k, 2]), k, listLCM]) → resultLCM
AI Drawing Prompt Reference
Create an interactive number theory panel with three input boxes for three integers and a calculate button. Display each integer's prime factorization with bases and exponents, sorted ascending. Below, show the highest common factor (HCF) and lowest common multiple (LCM) results, each with its prime factorization where exponents are the minimum (for HCF) or maximum (for LCM) among the three numbers. Use multiplication dots between factors. Include a language toggle button for Chinese/English.
The prompt above was compiled from the original drawing commands and is for reference only.