You are on page 1of 5

Problem 1: Counting the number of digits in a number.

Example :
HCF and GCD:

1) HCF of 8 and 6.
Factors of 8: 1,2,4,8
Factors of 6: 1,2,3
Minimum number that divides both the numbers is 1 and the maximum number that divides
both the numbers is minimum of both the numbers, here it is 6.

Therefore, the HCF/GCD should be in between 1 and 6.


Now find the largest number that divides both 6 and 8 and which is in between 1 and 6.

Method 2: Instead of starting from i=1, we can start from i=min and find the first largest factort.
LCM: (Least common multiple)

Multiples of 4: 4,8,12,16,20,24……...

Multiples of 5: 5,10,15,20, 25….

In the above problem the lowest common multiple is 20.

LCM is the first number in the list that is divisible by both the numbers (4 and 5), here it is 20.

 Multiples of 4 start from 4 and multiples of 5 start from 5, the common range for 4 and 5 will
start from 5.
 From the above the minimum common multiple of A and B will start from the maximum of A
and B.
 Minimum number that can be LCM of A and B is maximum of A and B and the maximum
number that can be LCM of A and B is A*B.
 Therefore, the LCM of two numbers A and B should be in between (maximum of A, B) and (A*B).

Note:

The product of LCM and GCD will be the product of two numbers.

LCM*GCD = A*B
 “continue” key word:
With help of continue key word we can skip a particular iteration.

Here the output will be, 1,2,4,5.

You might also like