Skip to content
This repository
Newer
Older
100644 113 lines (102 sloc) 4.595 kb
71f1fb3e » beneater
2012-09-11 Add alternative hints to some exercises for A/B testing
1 <!DOCTYPE html>
2e59498e » beneater
2012-09-11 Oops.. adding the correct alternative exercises
2 <html data-require="math word-problems graphie">
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Greatest common divisor</title>
6 <script src="../khan-exercise.js"></script>
7 </head>
8 <body>
9 <div class="exercise">
10 <div class="vars" data-ensure="A_START !== B_START">
11 <var id="A_START">randRange( 1, 10 )</var>
12 <var id="B_START">randRange( 1, 10 )</var>
13 <var id="FACTOR">randRange( 1, 5 )</var>
14
15 <var id="A">A_START * FACTOR</var>
16 <var id="B">B_START * FACTOR</var>
17 <var id="GCD">getGCD( A, B )</var>
18 <var id="A_FACTORS">getFactors( A )</var>
19 <var id="B_FACTORS">getFactors( B )</var>
20 <var id="COMMON_FACTORS">_.intersection( A_FACTORS, B_FACTORS )</var>
21 </div>
22
23 <div class="problems">
24 <div>
25 <div class="question">
26 <p>What is the greatest common divisor of <var>A</var> and <var>B</var>?</p>
27 <p>Another way to say this is: </p>
28 <p><code>\gcd(<var>A</var>, <var>B</var>) = {?}</code></p>
29 </div>
30
31 <p class="solution" data-forms="integer"><var>GCD</var></p>
32 </div>
33 </div>
34
35 <div class="hints">
36 <p>
37 The <em>greatest common divisor</em> is the largest number that divides evenly into both <code><var>A</var></code> and
38 <code><var>B</var></code>.
39 </p>
40
41 <p>
42 Start by thinking about all of the numbers that divide evenly into <code><var>A</var></code>. In other words,
43 what are the <em>divisors</em> of <code><var>A</var></code>?
44 </p>
45
46 <div>
47 <p data-if="A === 1">
48 The only divisor of <code>1</code> is <code class="hint_blue">1</code></span>
49 since that's the only number that divides evenly into <code>1</code>:
50 </p>
51 <p data-else>
52 The divisors of <code><var>A</var></code> are <span class="hint_blue"><var>toSentence( getFactors( A ) )</var></span>
53 since those are all the numbers that divide evenly into <code><var>A</var></code>:
54 </p>
55 <p style="margin-left: 20px">
56 <span data-each="getFactors( A ) as F">
57 <span style="display: inline-block; width: 20px;"><span style="display: none;" class="hint_pink"><code data-if="B % F === 0">\rhd</code></span></span>
58 <code><var>A</var> \div \color{<var>BLUE</var>}{<var>F</var>} = <var>A/F</var></code><br />
59 </span>
60 </p>
61 </div>
62
63 <p>
64 Start by thinking about all of the numbers that divide evenly into <code><var>B</var></code>. In other words,
65 what are the <em>divisors</em> of <code><var>B</var></code>?
66 </p>
67
68 <div>
69 <p data-if="B === 1">
70 The only divisor of <code>1</code> is <code class="hint_green">1</code></span>
71 since that's the only number that divides evenly into <code>1</code>:
72 </p>
73 <p data-else>
74 The divisors of <code><var>B</var></code> are <span class="hint_green"><var>toSentence( getFactors( B ) )</var></span>
75 since those are all the numbers that divide evenly into <code><var>B</var></code>:
76 </p>
77 <p style="margin-left: 20px">
78 <span data-each="getFactors( B ) as F">
79 <span style="display: inline-block; width: 20px;"><span style="display: none;" class="hint_pink"><code data-if="A % F === 0">\rhd</code></span></span>
80 <code><var>B</var> \div \color{<var>GREEN</var>}{<var>F</var>} = <var>B/F</var></code><br />
81 </span>
82 </p>
83 </div>
84
85 <p>
86 To find the <em>common divisors</em>, find the all the <span class="hint_blue">divisors of <code><var>A</var></code></span> and
87 <span class="hint_green">divisors of <code><var>B</var></code></span> that are the same.
88 </p>
89
90 <div>
91 <p data-if="GCD === 1">
92 The only <em>common divisor</var></em> of <code><var>A</var></code> and <code><var>B</var></code> is
93 <code class="hint_pink"><var>GCD</var></code> since that's the only number that divides
94 evenly into both <code><var>A</var></code> and <code><var>B</var></code>.
95 </p>
96 <p data-else>
97 The <em>common divisors</var></em> of <code><var>A</var></code> and <code><var>B</var></code> are
98 <span class="hint_pink"><var>toSentence( COMMON_FACTORS )</var></span> since each of those numbers divides
99 evenly into both <code><var>A</var></code> and <code><var>B</var></code>. We're interested in the <em>greatest</em> common divisor.
100 </p>
101 <div class="graphie">
102 jQuery( "span.hint_pink" ).show();
103 </div>
104 </div>
105
106 <p class="final_answer">
107 The greatest common divisor of <code><var>A</var></code> and <code><var>B</var></code> is <code><var>GCD</var></code>.
108 In other words, <code>\gcd(<var>A</var>, <var>B</var>) = <var>GCD</var></code>.
109 </p>
110 </div>
111 </div>
112 </body>
71f1fb3e » beneater
2012-09-11 Add alternative hints to some exercises for A/B testing
113 </html>
Something went wrong with that request. Please try again.