# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
114 lines (110 sloc) 6.59 KB
 Divisibility 0.5
randRange( 2, 9 ) floor( randRange( B * 2, 100 ) / B ) FACTOR * B getPrimeFactorization( A ) getPrimeFactorization( B ) (function() { var wrongs = []; var i = 2; while( i < 10 ) { if ( A % i !== 0 ) { wrongs.push( i ); } i++; } var shuffled = shuffle( wrongs, 4 ); shuffled.push( B ); return shuffled; })() sortNumbers( WRONGFACTORS )

Which of the following numbers is a factor of A?

\large{WRONGFACTORS_SORTED.join( "," )}

B

• wrong

By definition, a factor of a number will divide evenly into that number. We can start by dividing A by each of our answer choices.

A \div WRONG = floor( A / WRONG )\text{ R }( A % WRONG )

The only answer choice that divides into \blue{A} with no remainder is \pink{B}. \quadFACTOR \times \pink{B} = \blue{A}.

We can check our answer by looking at the prime factorization of both numbers. Notice that the prime factors of B are contained within the prime factors of A.

A = FACTORIZATION_A.join( "\\times" )\qquad\qquadB = FACTORIZATION_B.join( "\\times" )

Therefore, \pink{B} is a factor of \blue{A}.

randRange( 2, 9 ) floor( randRange( B * 2, 100 ) / B ) FACTOR * B getPrimeFactorization( A ) getPrimeFactorization( B ) (function() { var wrongs = []; while( wrongs.length < 4 ) { var i = randRange( 1, 100 ); if ( i % B !== 0 ) { wrongs.push( i ); } } var shuffled = shuffle( wrongs, 4 ); shuffled.push( A ); return shuffled; })() sortNumbers( WRONGMULTIPLES )

Which of the following numbers is a multiple of B?

\large{WRONGMULTIPLES_SORTED.join( "," )}

A

• wrong

The multiples of B are B, B*2, B*3, B*4...

In general, any number that leaves no remainder when divided by B is considered a multiple of B.

We can start by dividing each of our answer choices by B.

WRONG \div B = floor( WRONG / B )\text{ R }( WRONG % B )

The only answer choice that leaves no remainder after the division is \blue{A}. \quadFACTOR \times \pink{B} = \blue{A}.

We can check our answer by looking at the prime factorization of both numbers. Notice that the prime factors of B are contained within the prime factors of A.

A = FACTORIZATION_A.join( "\\times" )\qquad\qquadB = FACTORIZATION_B.join( "\\times" )

Therefore, \blue{A} is a multiple of \pink{B}.