Saturday 16 July 2016

What is the difference between two numbers if their LCM is 630 and HCF is 9 and the sum of the two numbers is 153?


Given GCD of two numbers is 9 and LCM is 630.
Let a, b be two numbers
As we know,
LCM × HCF = The product of given numbers
a×b=9×630
Given a+b=153
By using formula
(a-b)^2=(a+b)^2-4×a×b
(a-b)^2=(153^2)-(4×9×630)
(a-b)^2=729
x-y=27
Ans.27

Another Solution:

Let's assume the numbers are 9*a and 9*b (as the hcf is 9).
As we know,
LCM × HCF = The product of given numbers
So, (9*a)*(9*b) = 630*9
So, a*b = 70
Again 9*(a + b)= 153

By solving those two equations, we get either a=10, b=7 or a=7 , b=10
So either way, the two numbers are 90 and 63.
So, (ab)=27 or the difference between the two numbers is 27.
Ans.27

The LCM of 1, 2, 3, ... 60 is N. What is the LCM of 1, 2, 3, ... 65?


Answer: 61*2*n

We are given LCM (1, 2, 3 ... 60) = n
Now, we need to find out LCM (1, 2, 3... 65)

= LCM (n, 61, 62, 63, 64, 65) 
{The first 60 numbers can be replaced with 'n' as we already know their LCM}

= LCM (n, 61,64) 
{62, 63, and 65 can be broken down into prime factors which are in turn factors of n} 

= 61*2*n  
{61 is a prime number. 64 is 2^6. 2^5 occurs in 32. An extra 2 is required to accommodate it}

122n

Explanation:

Lcm of first 60 numbers is n, so we need to consider 5 more numbers 61...65. Lets use prime factorization and try to figure out how inclusion of each of these numbers will affect lcm.
61 - It is a prime number and so it has not been included in n till now. So Lcm of 1...61 become 61*n.
62 - Prime factorization of 62 is 2*31 and both of these numbers are already included in n. So lcm doesn't change by inclusion of 62 and it remains 61*n.
63 - Prime factorization of 63 is 3*3*7 and these numbers are already there in n. In fact 3 is there three times (for 27) and 7 is there two times (for 49). So inclusion of 63 also doesn't change lcm and lcm remain 61*n for numbers 1....63.
64 - Factorization of 64 is 2^6. Now 2^5 is already there in n for 32. So we need to include only one more 2, and lcm of numbers 1..upto 64 becomes 61*2*n.
65 - 65 factorizes as 5*13. Both of these numbers are there in n already and by inclusion of 65, lcm doesn't change. So it remains 61*2*n.

Thursday 14 July 2016

How-many-pairs-of-2-numbers-are-there-whose-LCM-is-N

If N= a^m*b^n *c^o then ordered solution such that LCM = N is (2m+1)*(2n+1)*(2o+1)
Unordered will be (2m+1)*(2n+1)*(2o+1) /2 +0.5

A 4 digit no. is formed using the digits 0,2,4,6,8 without repeating any 1 of them. What is the sum of all such possible no.s?

1)519960 2)402096 3)133320 4)4321302

If you fix 8 as the last digit, you see that there are 4*3*2 ways to complete the number. Thus, 8 appears 24 times as the last digit. By the same logic, if we enumerate all possible numbers using these 5 digits, each number appears 24 times in each of the 4 positions. That is, the digit 8 contributes (24*8+240*8+2400*8+24000*8). In total, we have
(0+2+4+6+8)(24+240+2400+24000)=533280
as our total sum.
In case 4-digit numbers cannot start with 0, then we have over-counted. Now we have to subtract the amount by which we over-counted, which is found by answering: "What is the sum of all 3-digit numbers formed by using digits 2,4,6, and 8?" Now if 8 appears as the last digit, then there are 6 ways to complete the number, so 8 contributes (6*8+60*8+600*8). In total, we have
(2+4+6+8)(6+60+600)=13320.
Subtracting this from the above gives us 519960.

Which is the Smallest number that has 4 prime factors & 48 total factors?

Take first 4 prime numbers as
2^a*3^b*5^c*7^d
Give maximum powers to 2 and 3 to get the minimum number 

(a+1)(b+1)(c+1)(d+1)=48
4*3*2*2=48
a=3 b=2 c=1 d=1

8*9*5*7=2520 Ans.

A ball is dropped from a height of 96 feet and it rebounds 2/3 of the height it falls. If it continues to fall and rebound, find the total distance that the ball can travel before coming to rest? 

a.240 ft b 360 ft c.480 ft d.none of these

Here is a trick if ball rebounds for 2/3 or for any other fraction (p/q) like 3/4, 1/2 or 5/2 
then use this (p+q)*height.
so we get, according to this question,

(2+3)*96= 480 Feet.

Another Trick:
96(1+r)/(1-r)=96(5/3)/(1/3)=480

Monday 4 July 2016

Power of 2

How do you find out if an unsigned integer is a power of 2?

The trick here is to know that an unsigned integer which is a power of 2 has only one of its bits as 1. So a simple solution would be to loop through the bits and count the number of 1s.
There is another solution which uses bit manipulation.
isPower = (x !=0 && !(x & (x-1)))
x & (x-1) will always give you a 0 if x is a power of 2. !(x & (x-1)) should give us what we want but there is one corner case. If x is 0, then the second term alone would return true when the answer should be false. We need the check to make sure x is not 0.