GIven numbers from 2 to 120, need to find total number of connected components
2 connects every even number
So every even number is a part of a single component.
Since 118 is a part of first component its half i.e. 59 will have an edge to 118, same with all odd number till 59(incl)
Now lets see about the odd numbers from 61 to 119
Every composite number is also a part of first component.
Why so? Since every composite number has a divisor other than 1 and itself, the largest composite number in the range is 120 and the smallest number it can be divided is 2, 120/2 =60, any other composite number will have its factors between 2 and 60.Hence they form a part of first component.
The remaining number are prime numbers: 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113. The count is 13. They form a single vertex component.
Hence in total 14 components.