Fetching contributors…
Cannot retrieve contributors at this time
62 lines (59 sloc) 3.24 KB
<!DOCTYPE html>
<html data-require="math word-problems">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script data-main="../local-only/main.js" src="../local-only/require.js"></script>
<div class="exercise">
<div class="vars" data-ensure="A !== ANSWER &amp;&amp; B !== ANSWER">
<var id="A">randRange( 10, 25 )</var>
<var id="B" data-ensure="A !== B">randRange( 10, 25 )</var>
<var id="LCM">getLCM( A, B )</var>
<var id="LCM_FACTORIZATION">getPrimeFactorization( LCM )</var>
<var id="ANSWER">
(function() {
var num = randRange( ceil( LCM_FACTORIZATION.length / 2 ), LCM_FACTORIZATION.length - 1 );
var shuffled = shuffle( LCM_FACTORIZATION );
var answer = 1;
for ( var i = 0; i &lt; num; i++ ) {
answer *= shuffled.shift();
return answer;
<var id="WRONGS">
(function() {
var wrongs = [];
while( wrongs.length &lt; 4 ) {
var w = randRange( 10, LCM );
if ( LCM % w !== 0 ) {
wrongs.push( w );
return wrongs;
<div class="problems">
<div class="question">All numbers divisible by both <code><var>A</var></code> and <code><var>B</var></code> are also divisible by which of the following?</div>
<p class="solution"><code><var>ANSWER</var></code></p>
<ul class="choices">
<li data-each="WRONGS as index, wrong"><code><var>wrong</var></code></li>
<div class="hints">
<p>A number is divisible by another number (a divisor) if its prime factorization contains the prime factorization of the divisor.</p>
<p>The prime factorization of <code><var>A</var></code> is <code><var>getPrimeFactorization( A ).join( "\\times" )</var></code>.</p>
<p>The prime factorization of <code><var>B</var></code> is <code><var>getPrimeFactorization( B ).join( "\\times" )</var></code>.</p>
<p>So, any number divisible by both must have <code><var>LCM_FACTORIZATION.join( "\\times" )</var></code> as part of its prime factorization.</p>
<p>All numbers which divide such a number will have a factorization which is part of <code><var>LCM_FACTORIZATION.join( "\\times" )</var></code>.</p>
<p>The prime factorization of <code><var>ANSWER</var></code> is <code><var>getPrimeFactorization( ANSWER ).join( "\\times" )</var></code>.</p>
<p>Since <code><var>getPrimeFactorization( ANSWER ).join( "\\times" )</var></code> is part of <code><var>LCM_FACTORIZATION.join( "\\times" )</var></code>, all numbers which are divisible by <code><var>A</var></code> and <code><var>B</var></code> are also divisible by <code><var>ANSWER</var></code>.</p>