Given four integers A, B, C and D. The task is to find the count of integers in the range [A, B] that are not divisible by C and D .
Input: A = 4, B = 9, C = 2, D = 3
5 and 7 are such integers.
Input: A = 10, B = 50, C = 4, D = 6
Approach: First include all the integers in the range in the required answer i.e. B – A + 1. Then remove all the numbers which are divisible by C and D and finally add all the numbers which are divisible by both C and D.
Below is the implementation of the above approach:
- Count integers in a range which are divisible by their euler totient value
- Ways to form an array having integers in given range such that total sum is divisible by 2
- Count of m digit integers that are divisible by an integer n
- Count of integers of the form (2^x * 3^y) in the range [L, R]
- Count numbers in range 1 to N which are divisible by X but not by Y
- Count the numbers divisible by 'M' in a given range
- Count of all even numbers in the range [L, R] whose sum of digits is divisible by 3
- Count numbers in range L-R that are divisible by all of its non-zero digits
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Minimum elements to be added in a range so that count of elements is divisible by K
- Count of integers in a range which have even number of odd digits and odd number of even digits
- Sum of last digit of all integers from 1 to N divisible by M
- Count the number of pairs (i, j) such that either arr[i] is divisible by arr[j] or arr[j] is divisible by arr[i]
- Number of substrings divisible by 6 in a string of integers
- Number of substrings divisible by 4 in a string of integers
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.