# Khan/khan-exercises

Fetching contributors…
Cannot retrieve contributors at this time
62 lines (59 sloc) 3.24 KB
 Divisibility
randRange( 10, 25 ) randRange( 10, 25 ) getLCM( A, B ) getPrimeFactorization( LCM ) (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 < num; i++ ) { answer *= shuffled.shift(); } return answer; })() (function() { var wrongs = []; while( wrongs.length < 4 ) { var w = randRange( 10, LCM ); if ( LCM % w !== 0 ) { wrongs.push( w ); } } return wrongs; })()
All numbers divisible by both A and B are also divisible by which of the following?

• wrong

A number is divisible by another number (a divisor) if its prime factorization contains the prime factorization of the divisor.

The prime factorization of A is getPrimeFactorization( A ).join( "\\times" ).

The prime factorization of B is getPrimeFactorization( B ).join( "\\times" ).

So, any number divisible by both must have LCM_FACTORIZATION.join( "\\times" ) as part of its prime factorization.

All numbers which divide such a number will have a factorization which is part of LCM_FACTORIZATION.join( "\\times" ).