File: /home/mmtprep/public_html/mathzen.mmtprep.com/assets/5A13-fsCS2tJI.js.map
{"version":3,"file":"5A13-fsCS2tJI.js","sources":["../../src/exercices/5e/5A13.js"],"sourcesContent":["import { choice, combinaisonListes } from '../../lib/outils/arrayOutils'\nimport { miseEnEvidence } from '../../lib/outils/embellissements'\nimport { compareNombres } from '../../lib/outils/nombres.js'\nimport { texFactorisation } from '../../lib/outils/primalite.js'\nimport { texNombre } from '../../lib/outils/texNombre.js'\nimport Exercice from '../Exercice.js'\nimport { context } from '../../modules/context.js'\nimport { listeQuestionsToContenu } from '../../modules/outils.js'\nimport { ajouteChampTexteMathLive } from '../../lib/interactif/questionMathLive.js'\nimport { sp } from '../../lib/outils/outilString.js'\nimport { setReponse } from '../../lib/interactif/gestionInteractif.js'\n\nexport const interactifReady = true\nexport const interactifType = 'mathLive'\nexport const amcReady = true\nexport const amcType = 'AMCOpen'\nexport const titre = 'Decompose into prime factors'\n\n/**\n * Décomposer en produit de facteurs premiers un nombre (la décomposition aura 3, 4 ou 5 facteurs premiers)\n * @author Rémi Angot\n 5A13\n */\nexport const uuid = '7f50c'\nexport const ref = '5A13'\nexport default function ExerciceDecomposerEnFacteursPremiers () {\n Exercice.call(this) // Héritage de la classe Exercice()\n this.spacing = 2\n this.nbQuestions = 6\n this.sup = 2 // 4 facteurs par défaut\n this.sup2 = false // pas de multiplication par 100\n this.sup3 = false // Que pour les 2ndes\n this.sup4 = false // Decomposition avec des puissances\n this.correctionDetailleeDisponible = true // booléen qui indique si une correction détaillée est disponible.\n this.correctionDetaillee = false // booléen indiquant si la correction détaillée doit être affiché par défaut (récupéré dans l'url avec le paramètre `,cd=`).\n\n this.nouvelleVersion = function () {\n this.consigne = this.nbQuestions > 1 ? 'Write the following numbers as a product of prime factors' : 'Write the following number as a product of prime factors'\n this.consigne += this.interactif ? ' arranged in ascending order.' : '.'\n if (this.level === 2) {\n this.sup = 3\n this.sup2 = true\n }\n this.listeQuestions = [] // Liste de questions\n this.listeCorrections = [] // Liste de questions corrigées\n this.autoCorrection = []\n let grandNombres\n let listeFacteurs1, listeFacteurs2\n if (this.sup3) {\n listeFacteurs1 = [2, 3, 5, 7, 11]\n listeFacteurs2 = [2, 3, 7, 13, 17]\n } else {\n listeFacteurs1 = [2, 3, 5]\n listeFacteurs2 = [2, 5, 7, 11]\n }\n if (this.sup2 && this.sup3) {\n grandNombres = combinaisonListes([true, true, false, true], this.nbQuestions)\n } else if (this.sup2) {\n grandNombres = combinaisonListes([false, false, false, true], this.nbQuestions)\n } else {\n grandNombres = combinaisonListes([false, false, false, false], this.nbQuestions)\n }\n this.sup = parseInt(this.sup)\n for (let i = 0, n, facteurs = [], nbFacteurs, texte, reponse, texteCorr, cpt = 0; i < this.nbQuestions && cpt < 50;) { // On limite le nombre d'essais pour chercher des valeurs nouvelles\n facteurs = []\n nbFacteurs = this.sup + 2\n for (let k = 0; k < nbFacteurs; k++) {\n if (k < nbFacteurs - 1) {\n if (nbFacteurs > 3 && k === 0) {\n this.sup3 ? facteurs.push(choice([2, 3])) : facteurs.push(2)\n } else if (nbFacteurs > 4 && k === 1) {\n this.sup3 ? facteurs.push(choice([2, 3])) : facteurs.push(2)\n } else {\n this.sup3 ? facteurs.push(choice(listeFacteurs1.concat(7))) : facteurs.push(choice(listeFacteurs1))\n }\n } else {\n this.sup3 ? facteurs.push(choice(listeFacteurs2.concat([3, 13]))) : facteurs.push(choice(listeFacteurs2))\n }\n }\n\n if (this.sup2 && grandNombres[i]) { // Une fois sur 4 on multilie le nombre par 100 (par 60 pour le niveau 2nde)\n this.sup3 ? facteurs.push(2, 2, 3, 5) : facteurs.push(2, 2, 5, 5)\n }\n n = 1\n for (let k = 0; k < facteurs.length; k++) {\n n = n * facteurs[k]\n }\n texte = '$' + texNombre(n) + ' =$'\n texteCorr = ''\n if (!this.correctionDetaillee) texteCorr += '$' + texNombre(n) + ' = $' + sp()\n\n reponse = ''\n facteurs.sort(compareNombres) // classe les facteurs dans l'ordre croissant\n let ensembleDeFacteurs = new Set(facteurs)\n ensembleDeFacteurs = [...ensembleDeFacteurs] // tableau des facteurs sans répétition\n let produitAvecPuissances = ''\n for (let k = 0; k < ensembleDeFacteurs.length; k++) {\n const facteur = ensembleDeFacteurs[k]\n let puissance = 0\n for (let j = 0; j < facteurs.length; j++) {\n if (facteurs[j] === facteur) puissance++\n }\n if (puissance > 1) {\n produitAvecPuissances += `${facteur}^${puissance}`\n } else {\n produitAvecPuissances += `${facteur}`\n }\n if (k !== ensembleDeFacteurs.length - 1) produitAvecPuissances += ' \\\\times'\n }\n let produitRestant = 1\n let debutDecomposition = ''\n let decompositionFinale = ''\n for (let k = 0; k < facteurs.length - 1; k++) {\n if (!this.sup3 && !this.sup4) {\n if (!this.correctionDetaillee) {\n texteCorr += `$${miseEnEvidence(facteurs[k] + '\\\\times')}$`\n }\n }\n if (this.correctionDetaillee) {\n debutDecomposition += facteurs[k] + ' \\\\times'\n for (let j = k + 1; j < facteurs.length; j++) {\n produitRestant = produitRestant * facteurs[j]\n }\n texteCorr += '$' + texNombre(n) + ' =' + debutDecomposition + produitRestant + '$<br>'\n decompositionFinale = sp() + debutDecomposition + produitRestant\n produitRestant = 1\n }\n reponse += facteurs[k] + '\\\\times'\n }\n\n if (!this.sup3 && !this.sup4) {\n if (!this.correctionDetaillee) {\n texteCorr += `$${miseEnEvidence(facteurs[facteurs.length - 1])}$`\n }\n } else {\n if (this.correctionDetaillee) texteCorr += '$' + texNombre(n) + ' =' + sp() + ' $'\n decompositionFinale = sp() + texFactorisation(n, true)\n texteCorr += `$${miseEnEvidence(decompositionFinale)}$`\n if (this.correctionDetaillee) texteCorr += '<br>'\n }\n if (this.correctionDetaillee) {\n texteCorr += `<br>So the decomposition into the product of prime factors of $${miseEnEvidence(texNombre(n), 'black')}$ is $${miseEnEvidence(decompositionFinale)}$.`\n }\n reponse += facteurs[facteurs.length - 1]\n\n if (context.isAmc) {\n this.autoCorrection[i] = {\n enonce: texte + '\\n',\n propositions: [{ texte: texteCorr, statut: 5, sanscadre: false, pointilles: true, feedback: '' }]\n }\n }\n texte += ajouteChampTexteMathLive(this, i, 'width75 inline nospacebefore')\n if (!context.isAmc) {\n setReponse(this, i, [reponse, produitAvecPuissances])\n }\n if (this.questionJamaisPosee(i, ...facteurs)) { // Si la question n'a jamais été posée, on en créé une autre\n this.listeQuestions.push(texte)\n this.listeCorrections.push(texteCorr)\n if (!context.isHtml) {\n this.canEnonce = `Decompose $${texNombre(n)}$ into product of prime factors.`\n this.correction = this.listeCorrections[0]\n this.canReponseACompleter = `$${texNombre(n)}=\\\\ldots$`\n this.listeCanEnonces.push(this.canEnonce)\n this.listeCanReponsesACompleter.push(this.canReponseACompleter)\n }\n i++\n }\n\n cpt++\n }\n listeQuestionsToContenu(this)\n }\n this.besoinFormulaireNumerique = ['Difficulty level', 3, '1: 3 factors\\n2: 4 factors\\n3: 5 factors']\n this.besoinFormulaire2CaseACocher = ['Large numbers (once in four)']\n}\n"],"names":["interactifReady","interactifType","amcReady","amcType","titre","uuid","ref","ExerciceDecomposerEnFacteursPremiers","Exercice","grandNombres","listeFacteurs1","listeFacteurs2","combinaisonListes","i","n","facteurs","nbFacteurs","texte","reponse","texteCorr","cpt","k","choice","texNombre","sp","compareNombres","ensembleDeFacteurs","produitAvecPuissances","facteur","puissance","j","produitRestant","debutDecomposition","decompositionFinale","miseEnEvidence","texFactorisation","context","ajouteChampTexteMathLive","setReponse","listeQuestionsToContenu"],"mappings":"wHAYY,MAACA,EAAkB,GAClBC,EAAiB,WACjBC,EAAW,GACXC,EAAU,UACVC,EAAQ,+BAORC,EAAO,QACPC,EAAM,OACJ,SAASC,GAAwC,CAC9DC,EAAS,KAAK,IAAI,EAClB,KAAK,QAAU,EACf,KAAK,YAAc,EACnB,KAAK,IAAM,EACX,KAAK,KAAO,GACZ,KAAK,KAAO,GACZ,KAAK,KAAO,GACZ,KAAK,8BAAgC,GACrC,KAAK,oBAAsB,GAE3B,KAAK,gBAAkB,UAAY,CACjC,KAAK,SAAW,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