This repository has been archived by the owner on May 11, 2021. It is now read-only.
/
least_common_multiple_and_greatest_common_divisor_word_problems.html
707 lines (652 loc) · 38.1 KB
/
least_common_multiple_and_greatest_common_divisor_word_problems.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
<!DOCTYPE html>
<html data-require="math word-problems spin">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Least common multiple and greatest common divisor word problems</title>
<script src="../khan-exercise.js"></script>
<style>
.gcd-column {
position: relative;
float: left;
margin-left: 20px;
}
</style>
</head>
<body>
<div class="exercise">
<div class="problems">
<div id="lcm-hot-dog-count">
<div class="vars" data-ensure="LCM !== A && LCM !== B">
<var id="C">randRange( 2, 6 )</var>
<var id="START_A">randRange( 1, 10 )</var>
<var id="START_B">randRangeExclude( 1, 10, [ START_A ] )</var>
<var id="A">START_A * C</var>
<var id="B">START_B * C</var>
<var id="PRODUCT">A * B</var>
<var id="GCD">getGCD( A, B )</var>
<var id="LCM">PRODUCT / GCD</var>
</div>
<p class="problem spin">
{Next week|On Saturday}, <var>person(1)</var> is having a party{ and <var>he(1)</var>'s planning to play <var>his(1)</var>
<var>randRange(2,30)</var> favorite songs. <var>He(1)</var> also|. <var>He(1)</var>} wants to get some hot dogs for the party. When <var>he(1)</var>
goes to the store, <var>he(1)</var> finds that hot dogs come in packages of <var>A</var> and buns come in packages of <var>B</var>.
</p>
<p class="question">
If <var>person(1)</var> wants to have the same number of hot dogs and buns,
what is the minimum number of hot dogs <var>he(1)</var> will have to buy?
</p>
<p class="solution" data-forms="integer"><var>LCM</var></p>
<div class="hints">
<div>
<p>
We know that hot dogs come in packages of <code><var>A</var></code>. Write out the first few multiples
of <code><var>A</var></code> to see the possible numbers of hot dogs <var>person(1)</var> can buy:
</p>
<p>
<code>\qquad dogs: </code>
<span data-each="getMultiples( A, min( LCM * 2 + A * 2, max( A * 14, LCM ) ) ) as M"><code><var>M</var>,</code> </span>
<code>...</code>
</p>
</div>
<div>
<p>
We know that buns come in packages of <code><var>B</var></code>. Write out the first few multiples
of <code><var>B</var></code> to see the possible numbers of buns <var>person(1)</var> can buy:
</p>
<p>
<code>\qquad buns: </code>
<span data-each="getMultiples( B, min( LCM * 2 + B * 2, max( B * 14, LCM ) ) ) as M"><code><var>M</var>,</code> </span>
<code>...</code>
</p>
</div>
<div>
<p>
Since <var>person(1)</var> wants to have the same number of hot dogs and buns, look for <em>common multiples</em> where it's
possible to buy the same number of hot dogs and buns:
</p>
<p>
<code>\qquad dogs: </code>
<span data-each="getMultiples( A, min( LCM * 2 + A * 2, max( A * 14, LCM ) ) ) as M">
<span data-if="M % LCM === 0 && M / LCM === 1">
<code>\color{<var>PINK</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 2">
<code>\color{<var>BLUE</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 3">
<code>\color{<var>GREEN</var>}{<var>M</var>},</code>
</span>
<span data-else>
<code><var>M</var>,</code>
</span>
</span>
<code>...</code>
</p>
<p>
<code>\qquad buns: </code>
<span data-each="getMultiples( B, min( LCM * 2 + B * 2, max( B * 14, LCM ) ) ) as M">
<span data-if="M % LCM === 0 && M / LCM === 1">
<code>\color{<var>PINK</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 2">
<code>\color{<var>BLUE</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 3">
<code>\color{<var>GREEN</var>}{<var>M</var>},</code>
</span>
<span data-else>
<code><var>M</var>,</code>
</span>
</span>
<code>...</code>
</p>
</div>
<p>
The <em>least</em> common multiple is the minimum number of hot dogs <var>person(1)</var> will have to buy to get
the same number of hot dogs and buns.
</p>
<p><code class="hint_pink"><var>LCM</var></code> is the least common multiple of <code><var>A</var></code> and <code><var>B</var></code>.</p>
<p>
To get the same number of each, <strong>the smallest amount of food <var>person(1)</var> can buy is <var>LCM</var> hot dogs and buns</strong>,
or <var>plural(LCM/A,"package")</var> of hot dogs and <var>plural(LCM/B,"package")</var> of buns.
</p>
</div>
</div>
<div id="lcm-uniforms">
<div class="vars" data-ensure="LCM !== A && LCM !== B">
<var id="C">randRange( 2, 6 )</var>
<var id="START_A">randRange( 1, 10 )</var>
<var id="START_B">randRangeExclude( 1, 10, [ START_A ] )</var>
<var id="A">START_A * C</var>
<var id="B">START_B * C</var>
<var id="PRODUCT">A * B</var>
<var id="GCD">getGCD( A, B )</var>
<var id="LCM">PRODUCT / GCD</var>
</div>
<p class="problem spin">
<var>person(1)</var> is organizing a {baseball|softball} league, and <var>he(1)</var> needs to purchase jerseys and
visors for the players. Jerseys come in sets of <var>A</var>, and visors come in sets of <var>B</var>.
</p>
<p class="question">
If <var>person(1)</var> wants to buy the same number of jerseys and visors,
what is the minimum number of jerseys or visors <var>he(1)</var> will have to purchase?
</p>
<p class="solution" data-forms="integer"><var>LCM</var></p>
<div class="hints">
<div>
<p>
We know that jerseys come in packages of <code><var>A</var></code>. Write out the first few multiples
of <code><var>A</var></code> to see the possible numbers of jerseys <var>person(1)</var> can buy:
</p>
<p>
<code>\qquad jerseys: </code>
<span data-each="getMultiples( A, min( LCM * 2 + A * 2, max( A * 12, LCM ) ) ) as M"><code><var>M</var>,</code> </span>
<code>...</code>
</p>
</div>
<div>
<p>
We know that visors come in packages of <code><var>B</var></code>. Write out the first few multiples
of <code><var>B</var></code> to see the possible numbers of visors <var>person(1)</var> can buy:
</p>
<p>
<code>\qquad visors: </code>
<span data-each="getMultiples( B, min( LCM * 2 + B * 2, max( B * 12, LCM ) ) ) as M"><code><var>M</var>,</code> </span>
<code>...</code>
</p>
</div>
<div>
<p>
Since <var>person(1)</var> wants to have the same number of jerseys and visors, look for <em>common multiples</em> where it's
possible to buy the same number of jerseys and visors:
</p>
<p>
<code>\qquad jerseys: </code>
<span data-each="getMultiples( A, min( LCM * 2 + A * 2, max( A * 12, LCM ) ) ) as M">
<span data-if="M % LCM === 0 && M / LCM === 1">
<code>\color{<var>PINK</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 2">
<code>\color{<var>BLUE</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 3">
<code>\color{<var>GREEN</var>}{<var>M</var>},</code>
</span>
<span data-else>
<code><var>M</var>,</code>
</span>
</span>
<code>...</code>
</p>
<p>
<code>\qquad visors: </code>
<span data-each="getMultiples( B, min( LCM * 2 + B * 2, max( B * 12, LCM ) ) ) as M">
<span data-if="M % LCM === 0 && M / LCM === 1">
<code>\color{<var>PINK</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 2">
<code>\color{<var>BLUE</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 3">
<code>\color{<var>GREEN</var>}{<var>M</var>},</code>
</span>
<span data-else>
<code><var>M</var>,</code>
</span>
</span>
<code>...</code>
</p>
</div>
<p>
The <em>least</em> common multiple is the minimum number of jerseys <var>person(1)</var> will have to buy to get
the same number of jerseys and visors.
</p>
<p><code class="hint_pink"><var>LCM</var></code> is the least common multiple of <code><var>A</var></code> and <code><var>B</var></code>.</p>
<p>
To get the same number of each, <strong>the smallest number <var>person(1)</var> can buy is <var>LCM</var> jerseys and visors</strong>,
or <var>plural( LCM / A, "set" )</var> of jerseys and <var>plural( LCM / B, "set" )</var> of visors.
</p>
</div>
</div>
<div id="lcm-test-questions">
<div class="vars" data-ensure="LCM !== A && LCM !== B">
<var id="C">randRange( 2, 6 )</var>
<var id="START_A">randRange( 1, 10 )</var>
<var id="START_B">randRangeExclude( 1, 10, [ START_A ] )</var>
<var id="A">START_A * C</var>
<var id="B">START_B * C</var>
<var id="PRODUCT">A * B</var>
<var id="GCD">getGCD( A, B )</var>
<var id="LCM">PRODUCT / GCD</var>
</div>
<div class="problem">
<p class="spin">
<var>person(1)</var> and <var>person(2)</var> are in different <var>course(1)</var> classes at <var>school(1)</var>.
<span data-if="A > B">
<var>person(1)</var>'s teacher always gives <var>plural( exam(1) )</var> with <var>A</var> questions on them while
<var>person(2)</var>'s teacher gives more frequent <var>plural( exam(1) )</var> with only <var>B</var> questions.
</span>
<span data-else>
<var>person(2)</var>'s teacher always gives <var>plural( exam(1) )</var> with <var>B</var> questions on them while
<var>person(1)</var>'s teacher gives more frequent <var>plural( exam(1) )</var> with only <var>A</var> questions.
</span>
{<var>person(1)</var> has <var>randRange(15,40)</var> other students in <var>his(1)</var> class.
|<var>person(2)</var>'s teacher also assigns <var>randRange(3,10)</var> projects per year.}
</p>
<p>
Even though the two classes have to take a different number of <var>plural( exam(1) )</var>, their teachers have
told them that both classes will get the same total number of <var>exam(1)</var> questions each year.
</p>
</div>
<p class="question">
What is the minimum number of <var>exam(1)</var> questions <var>person(1)</var>'s or <var>person(2)</var>'s class
can expect to get in a year?
</p>
<p class="solution" data-forms="integer"><var>LCM</var></p>
<div class="hints">
<div>
<p>
We know that in <var>person(1)</var>'s class, all the <var>plural( exam(1) )</var> have <code><var>A</var></code> questions. Write
out the first few multiples of <code><var>A</var></code> to see the possible numbers of questions
<var>person(1)</var> might have to answer over the whole year:
</p>
<p>
<code>\qquad</code>
<span data-each="getMultiples( A, min( LCM * 2 + A * 2, max( A * 15, LCM ) ) ) as M"><code><var>M</var>,</code> </span>
<code>...</code>
</p>
</div>
<div>
<p>
We know that in <var>person(2)</var>'s class, all the <var>plural( exam(1) )</var> have <code><var>B</var></code> questions. Write
out the first few multiples of <code><var>B</var></code> to see the possible numbers of questions
<var>person(2)</var> might have to answer over the whole year:
</p>
<p>
<code>\qquad</code>
<span data-each="getMultiples( B, min( LCM * 2 + B * 2, max( B * 15, LCM ) ) ) as M"><code><var>M</var>,</code> </span>
<code>...</code>
</p>
</div>
<div>
<p>
Since <var>person(1)</var>'s and <var>person(2)</var>'s teachers have told them that both classes will have the same total
number of <var>exam(1)</var> questions over the whole year, look for the <em>common multiples</em> to find the possible
numbers of <var>exam(1)</var> questions they will have to answer.
</p>
<p>
<code>\qquad</code>
<span data-each="getMultiples( A, min( LCM * 2 + A * 2, max( A * 15, LCM ) ) ) as M">
<span data-if="M % LCM === 0 && M / LCM === 1">
<code>\color{<var>PINK</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 2">
<code>\color{<var>BLUE</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 3">
<code>\color{<var>GREEN</var>}{<var>M</var>},</code>
</span>
<span data-else>
<code><var>M</var>,</code>
</span>
</span>
<code>...</code>
</p>
<p>
<code>\qquad</code>
<span data-each="getMultiples( B, min( LCM * 2 + B * 2, max( B * 15, LCM ) ) ) as M">
<span data-if="M % LCM === 0 && M / LCM === 1">
<code>\color{<var>PINK</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 2">
<code>\color{<var>BLUE</var>}{<var>M</var>},</code>
</span>
<span data-else-if="M % LCM === 0 && M / LCM === 3">
<code>\color{<var>GREEN</var>}{<var>M</var>},</code>
</span>
<span data-else>
<code><var>M</var>,</code>
</span>
</span>
<code>...</code>
</p>
</div>
<p>
The <em>least</em> common multiple is the minimum number questions <var>person(1)</var> and <var>person(2)</var> might
have to answer over the year.
</p>
<p><code class="hint_pink"><var>LCM</var></code> is the least common multiple of <code><var>A</var></code> and <code><var>B</var></code>.</p>
<p>
If <var>person(1)</var>'s and <var>person(2)</var>'s classes get the same total number of questions,
<strong>the minimum number of <var>exam(1)</var> questions they can expect to get in a year is <var>LCM</var> questions</strong>,
or <var>plural( LCM / A, exam(1) )</var> in <var>person(1)</var>'s class and <var>plural( LCM / B, exam(1) )</var> in <var>person(2)</var>'s class.
</p>
</div>
</div>
<div id="gcd-teams">
<div class="vars" data-ensure="A_START !== B_START">
<var id="A_START">randRange( 1, 10 )</var>
<var id="B_START">randRange( 1, 10 )</var>
<var id="FACTOR">randRange( 2, 5 )</var>
<var id="A">A_START * FACTOR</var>
<var id="B">B_START * FACTOR</var>
<var id="GCD">getGCD( A, B )</var>
<var id="A_FACTORS">getFactors( A )</var>
<var id="B_FACTORS">getFactors( B )</var>
</div>
<div class="question spin">
<p>
At a track and field competition, there are <var>A</var> sprinters and <var>B</var> long-distance
runners{ and <var>randRange(5,100)</var> fans|}. <var>person(1)</var> has to assign all of the athletes
to teams. <var>He(1)</var> wants to make sure all of the teams have the same number of sprinters and
the same number of long-distance runners.
</p>
<p><strong>What is the greatest number of teams <var>person(1)</var> can form?</strong></p>
</div>
<p class="solution" data-forms="integer"><var>GCD</var></p>
<div class="hints">
<p>
Let's start by just thinking about the sprinters. We can think about all the ways to divide the
<var>A</var> sprinters into equally sized teams by finding the factors of <var>A</var>.
</p>
<div>
<p>
The factors of <var>A</var> are <span class="hint_blue"><var>toSentence( getFactors( A ) )</var></span> since
those are all the numbers that divide evenly into <var>A</var>.
That means we can divide the sprinters into equally sized teams in any of the following ways:
</p>
<p style="margin-left: 20px">
<span data-each="getFactors( A ) as F" class="hint_blue">
<var>plural( F, "team" )</var> with <var>plural( A / F, "sprinter" )</var> <var>plural( "", "each", F )</var><br />
</span>
</p>
</div>
<p>
Now lets think about the long-distance runners. We can also list all the ways to divide the
<var>B</var> long-distance runners into equally sized teams by finding the factors of <var>B</var>.
</p>
<div>
<p>
The factors of <var>B</var> are <span class="hint_green"><var>toSentence( getFactors( B ) )</var></span> since
those are all the numbers that divide evenly into <var>B</var>.
That means we can divide the long-distance runners into equally sized teams in any of the following ways:
</p>
<p style="margin-left: 20px">
<span data-each="getFactors( B ) as F" class="hint_green">
<var>plural( F, "team" )</var> with <var>plural( B / F, "long-distance runner" )</var> <var>plural( "", "each", F )</var><br />
</span>
</p>
</div>
<div>
<p>
Since each team will have sprinters and long-distance runners, compare the numbers of teams the sprinters can be divided into and
the numbers of teams the runners can be divided into to find the <em>common divisors</em>:
</p>
<div class="gcd-column">
<span data-each="max( A, B ) times as N">
<span data-if="$.inArray( N + 1, A_FACTORS ) !== -1" class="hint_blue">
<var>plural( N + 1, "team" )</var> with <var>plural( A / ( N + 1 ), "sprinter" )</var><br />
</span>
<span data-else-if="$.inArray( N + 1, B_FACTORS ) !== -1">
<br />
</span>
</span>
</div>
<div class="gcd-column">
<span data-each="max( A, B ) times as N">
<span data-if="$.inArray( N + 1, B_FACTORS ) !== -1" class="hint_green">
<var>plural( N + 1, "team" )</var> with <var>plural( B / ( N + 1 ), "long-distance runner" )</var><br />
</span>
<span data-else-if="$.inArray( N + 1, A_FACTORS ) !== -1">
<br />
</span>
</span>
</div>
<div class="ui-helper-clearfix"></div>
</div>
<div>
<p>
The common divisors of <var>A</var> and <var>B</var> are <span class="hint_pink"><var>toSentence( _.intersection( A_FACTORS, B_FACTORS ) )</var></span>.
In other words, with <var>A</var> sprinters and <var>B</var> long-distance runners,
<var>person(1)</var> can make the following equal teams:
</p>
<p style="margin-left: 20px">
<span data-each="_.intersection( A_FACTORS, B_FACTORS ) as F" class="hint_pink">
<var>plural( F, "team" )</var> with <var>plural( A / F, "sprinter" )</var> and
<var>plural( B / F, "long-distance runner" )</var>
<br />
</span>
</p>
</div>
<p>
We want to know the <em>greatest</em> number of equal teams <var>person(1)</var> can make, so from the common divisors above,
we want the <em>greatest common divisor</em>.
</p>
<p>
<strong>The greatest number of teams that <var>person(1)</var> can form is <var>GCD</var> teams</strong>,
with <var>plural( A / GCD, "sprinter" )</var> and <var>plural( B / GCD, "long-distance runner" )</var> per team.
</p>
</div>
</div>
<div id="gcd-restaurant">
<div class="vars" data-ensure="A_START !== B_START">
<var id="A_START">randRange( 1, 10 )</var>
<var id="B_START">randRange( 1, 10 )</var>
<var id="FACTOR">randRange( 2, 5 )</var>
<var id="A">A_START * FACTOR</var>
<var id="B">B_START * FACTOR</var>
<var id="GCD">getGCD( A, B )</var>
<var id="A_FACTORS">getFactors( A )</var>
<var id="B_FACTORS">getFactors( B )</var>
</div>
<div class="problem spin">
<p>
At <var>person(1)</var>'s bakery, <var>person(1)</var> bakes one batch of <var>A</var> chocolate chip cookies
and one batch of <var>B</var> oatmeal cookies each day. <var>person(1)</var> sells all <var>his(1)</var> cookies
the same day in gift baskets.
</p>
<p>
{Because <var>his(1)</var> customers expect consistency|To keep the price the same}, <var>person(1)</var> wants
to make sure each gift basket is identical.
</p>
</div>
<p class="question">
What is the greatest number of gift baskets <var>person(1)</var> can sell each day?
</p>
<p class="solution" data-forms="integer"><var>GCD</var></p>
<div class="hints">
<p>
Let's start by just thinking about the chocolate chip cookies. We can think about all the ways to equally
divide the <var>A</var> chocolate chip cookies into gift baskets by finding the factors of <var>A</var>.
</p>
<div>
<p>
The factors of <var>A</var> are <span class="hint_blue"><var>toSentence( getFactors( A ) )</var></span> since
those are all the numbers that divide evenly into <var>A</var>.
That means we can equally divide the chocolate chip cookies into gift baskets in any of the following ways:
</p>
<p style="margin-left: 20px">
<span data-each="getFactors( A ) as F" class="hint_blue">
<var>plural( F, "basket" )</var> with <var>plural( A / F, "chocolate chip cookie" )</var> <var>plural( "", "each", F )</var><br />
</span>
</p>
</div>
<p>
Now lets think about the oatmeal cookies. We can also list all the ways to equally divide the
<var>B</var> oatmeal cookies into gift baskets by finding the factors of <var>B</var>.
</p>
<div>
<p>
The factors of <var>B</var> are <span class="hint_green"><var>toSentence( getFactors( B ) )</var></span> since
those are all the numbers that divide evenly into <var>B</var>.
That means we can equally divide the oatmeal cookies into gift baskets in any of the following ways:
</p>
<p style="margin-left: 20px">
<span data-each="getFactors( B ) as F" class="hint_green">
<var>plural( F, "basket" )</var> with <var>plural( B / F, "oatmeal cookie" )</var> <var>plural( "", "each", F )</var><br />
</span>
</p>
</div>
<div>
<p>
Since each gift basket will have chocolate chip and oatmeal cookies, compare the ways of dividing the chocolate chip cookies
and the ways of dividing the oatmeal cookies to find the <em>common divisors</em>:
</p>
<div class="gcd-column">
<span data-each="max( A, B ) times as N">
<span data-if="$.inArray( N + 1, A_FACTORS ) !== -1" class="hint_blue">
<var>plural( N + 1, "basket" )</var> with <var>plural( A / ( N + 1 ), "chocolate chip cookie" )</var><br />
</span>
<span data-else-if="$.inArray( N + 1, B_FACTORS ) !== -1">
<br />
</span>
</span>
</div>
<div class="gcd-column">
<span data-each="max( A, B ) times as N">
<span data-if="$.inArray( N + 1, B_FACTORS ) !== -1" class="hint_green">
<var>plural( N + 1, "basket" )</var> with <var>plural( B / ( N + 1 ), "oatmeal cookie" )</var><br />
</span>
<span data-else-if="$.inArray( N + 1, A_FACTORS ) !== -1">
<br />
</span>
</span>
</div>
<div class="ui-helper-clearfix"></div>
</div>
<div>
<p>
The common divisors of <var>A</var> and <var>B</var> are <span class="hint_pink"><var>toSentence( _.intersection( A_FACTORS, B_FACTORS ) )</var></span>.
In other words, with <var>A</var> chocolate chip and <var>B</var> oatmeal cookies,
<var>person(1)</var> can make any of the following gift baskets:
</p>
<p style="margin-left: 20px">
<span data-each="_.intersection( A_FACTORS, B_FACTORS ) as F" class="hint_pink">
<var>plural( F, "basket" )</var> with <var>plural( A / F, "chocolate chip cookie" )</var> and
<var>plural( B / F, "oatmeal cookie" )</var>
<br />
</span>
</p>
</div>
<p>
We want to know the <em>greatest</em> number of identical gift baskets <var>person(1)</var> can make, so from the common divisors above,
we want the <em>greatest common divisor</em>.
</p>
<p>
<strong>The greatest number of gift baskets that <var>person(1)</var> can make each day is <var>GCD</var> baskets</strong>,
with <var>plural( A / GCD, "chocolate chip cookie" )</var> and <var>plural( B / GCD, "oatmeal cookie" )</var> per basket.
</p>
</div>
</div>
<div id="gcd-office-supplies">
<div class="vars" data-ensure="A_START !== B_START">
<var id="A_START">randRange( 1, 10 )</var>
<var id="B_START">randRange( 1, 10 )</var>
<var id="FACTOR">randRange( 2, 5 )</var>
<var id="A">A_START * FACTOR</var>
<var id="B">B_START * FACTOR</var>
<var id="GCD">getGCD( A, B )</var>
<var id="A_FACTORS">getFactors( A )</var>
<var id="B_FACTORS">getFactors( B )</var>
</div>
<div class="problem spin">
<p>
<var>person(1)</var> just bought 1 package of <var>plural( A, deskItem(1) )</var> and 1 package of
<var>plural( B, deskItem(2) )</var>. <var>He(1)</var> wants to use all of the <var>plural( deskItem(1) )</var>
and <var>plural( deskItem(2) )</var> to create identical sets of office supplies for <var>his(1)</var>
{coworkers|friends|classmates}.
</p>
</div>
<p class="question">
What is the greatest number of sets of office supplies <var>person(1)</var> can make?
</p>
<p class="solution" data-forms="integer"><var>GCD</var></p>
<div class="hints">
<p>
Let's start by just thinking about the <var>plural( deskItem(1) )</var>. We can think about all the ways to
equally divide the <var>plural( A, deskItem(1) )</var> into sets by finding the factors of <var>A</var>.
</p>
<div>
<p>
The factors of <var>A</var> are <span class="hint_blue"><var>toSentence( getFactors( A ) )</var></span> since
those are all the numbers that divide evenly into <var>A</var>.
That means we can equally divide the <var>plural( deskItem(1) )</var> into sets in any of the following ways:
</p>
<p style="margin-left: 20px">
<span data-each="getFactors( A ) as F" class="hint_blue">
<var>plural( F, "set" )</var> with <var>plural( A / F, deskItem(1) )</var> <var>plural( "", "each", F )</var><br />
</span>
</p>
</div>
<p>
Now lets think about the <var>plural( deskItem(2) )</var>. We can also list all the ways to equally divide the
<var>plural( B, deskItem(2) )</var> into sets by finding the factors of <var>B</var>.
</p>
<div>
<p>
The factors of <var>B</var> are <span class="hint_green"><var>toSentence( getFactors( B ) )</var></span> since
those are all the numbers that divide evenly into <var>B</var>.
That means we can equally divide the <var>plural( deskItem(2) )</var> into sets in any of the following ways:
</p>
<p style="margin-left: 20px">
<span data-each="getFactors( B ) as F" class="hint_green">
<var>plural( F, "set" )</var> with <var>plural( B / F, deskItem(2) )</var> <var>plural( "", "each", F )</var><br />
</span>
</p>
</div>
<div>
<p>
Since each set will have <var>plural( deskItem(1) )</var> and <var>plural( deskItem(2) )</var>, compare the
ways of dividing the <var>plural( deskItem(1) )</var> and the ways of dividing the
<var>plural( deskItem(2) )</var> to find the <em>common divisors</em>:
</p>
<div class="gcd-column">
<span data-each="max( A, B ) times as N">
<span data-if="$.inArray( N + 1, A_FACTORS ) !== -1" class="hint_blue">
<var>plural( N + 1, "set" )</var> with <var>plural( A / ( N + 1 ), deskItem(1) )</var><br />
</span>
<span data-else-if="$.inArray( N + 1, B_FACTORS ) !== -1">
<br />
</span>
</span>
</div>
<div class="gcd-column">
<span data-each="max( A, B ) times as N">
<span data-if="$.inArray( N + 1, B_FACTORS ) !== -1" class="hint_green">
<var>plural( N + 1, "set" )</var> with <var>plural( B / ( N + 1 ), deskItem(2) )</var><br />
</span>
<span data-else-if="$.inArray( N + 1, A_FACTORS ) !== -1">
<br />
</span>
</span>
</div>
<div class="ui-helper-clearfix"></div>
</div>
<div>
<p>
The common divisors of <var>A</var> and <var>B</var> are <span class="hint_pink"><var>toSentence( _.intersection( A_FACTORS, B_FACTORS ) )</var></span>.
In other words, with <var>plural( A, deskItem(1) )</var> and <var>plural( B, deskItem(2) )</var>,
<var>person(1)</var> can make any of the following sets:
</p>
<p style="margin-left: 20px">
<span data-each="_.intersection( A_FACTORS, B_FACTORS ) as F" class="hint_pink">
<var>plural( F, "set" )</var> with <var>plural( A / F, deskItem(1) )</var> and
<var>plural( B / F, deskItem(2) )</var>
<br />
</span>
</p>
</div>
<p>
We want to know the <em>greatest</em> number of identical sets <var>person(1)</var> can make, so from the common divisors above,
we want the <em>greatest common divisor</em>.
</p>
<p>
<strong>The greatest number of sets of office supplies that <var>person(1)</var> can make is <var>GCD</var> sets</strong>,
with <var>plural( A / GCD, deskItem(1) )</var> and <var>plural( B / GCD, deskItem(2) )</var> each.
</p>
</div>
</div>
</div>
</div>
</body>
</html>