HCF & LCM of Three Numbers via Prime Factorization

HCF & LCM of Three Numbers via Prime Factorization
Loading the math board and drawing, please wait…
2020-08-19 17:45
① 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

  1. Factors(b) → M2
  2. Unique(PrimeFactors[b]) → listB
  3. Factors(a) → M1
  4. Unique(PrimeFactors[a]) → listA
  5. Factors(c) → M3
  6. Unique(PrimeFactors[c]) → listC
  7. Sort(Union[Union[listA, listB], listC]) → listPrime
  8. Zip(If[Defined[IndexOf[k, listB]], Element[M2, IndexOf[k, listB], 2], 0], k, listPrime) → listB2
  9. Zip(If[Defined[IndexOf[k, listC]], Element[M3, IndexOf[k, listC], 2], 0], k, listPrime) → listC2
  10. Zip(If[Defined[IndexOf[k, listA]], Element[M1, IndexOf[k, listA], 2], 0], k, listPrime) → listA2
  11. Zip({k, Min[{m, n, p}]}, k, listPrime, m, listA2, n, listB2, p, listC2) → listHCF
  12. KeepIf(Element[k, 2] ≠ 0, k, listHCF) → listHCF'
  13. Product(Zip[Element[k, 1]^(Element[k, 2]), k, listHCF']) → resultHCF
  14. If(listHCF' ≟ {}, 1, resultHCF) → resultHCF'
  15. Zip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[M1], UnicodeToLetter[8901], ""]), p, M1) → listTextA
  16. Textfield(a) → inputBox1
  17. Zip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[M2], UnicodeToLetter[8901], ""]), p, M2) → listTextB
  18. Textfield(b) → inputBox2
  19. Zip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[listHCF'], UnicodeToLetter[8901], ""]), p, listHCF') → listTextHCF
  20. Zip({k, Max[{m, n, p}]}, k, listPrime, m, listA2, n, listB2, p, listC2) → listLCM
  21. Zip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[listLCM], UnicodeToLetter[8901], ""]), p, listLCM) → listTextLCM
  22. LaTeX("\text{LCM= }" + (Sum[listTextLCM])) → textLCM
  23. Textfield(c) → inputBox3
  24. Zip(((Element[p, 1] * If[Element[p, 2] ≠ 1, (("^{" * Element[p, 2]) * "}")]) * If[{p} ≠ Last[M3], UnicodeToLetter[8901], ""]), p, M3) → listTextC
  25. Product(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.