The way you have mentioned to find the no of element looks wrong to me ..... for correct answer we have to divide the n by LCM of the two number........... for example if you want to find total number of element for number less than 13 which are divisible by 2 and 3 .... Then correct answer is 2 (6 and 12) but by using your way answer is 1 (12/(2*3))....
@ashutosh.sharma5 жыл бұрын
(12/(2*3)) = 2
@shivanshsrivastava92795 жыл бұрын
In this problem we are dealing with only prime numbers, so LCM of numbers would be same as a*b*c*d....... But if you are dealing with general numbers then you need to find lcm of all numbers.
@musicfan16954 жыл бұрын
@@shivanshsrivastava9279 yes shivansh , you're right
@ritikkaushik71314 жыл бұрын
bro we are asking either 2 or 3 not both
@harshsagar95706 жыл бұрын
Amazing!
@CodingBlocksIndia6 жыл бұрын
thanks harsh- prateek bhayia
@abhinavreddy53504 жыл бұрын
Superb...
@kshitijagarwal32306 жыл бұрын
Can u please make a video on segmented sieve? Would be of great help!!!
@siddhartha1664 жыл бұрын
ya please
@PiyushKumar-xv1ud4 жыл бұрын
What is the meaning of (long long denom = 1 long long ) in line 19 ??
@raghavagarwal56884 жыл бұрын
by default a constant 1 written in code will be stored in memory as an int, so doing long long l= 1; will baically store an int 1 then upgrade it to long long and then store it in l. Doing it like this will make the computer store the 1 as long long from the got go. this is mainly useful to prevent overflows
@GateCSE2806 жыл бұрын
Sir😎
@anirudh2476 жыл бұрын
Sir but the time complexity of the problem you have done is too much, is it possible to do the problem in a more efficient way?
@CodingBlocksIndia6 жыл бұрын
The complexity here is exponential which satisfies the question contraints that N is less than 20.