do anyone know any formula for calculating the no of multiples of a or b or c within a range
Answers
Answered by
0
To count the number of multiples of n between a and b, you need to use the floor and ceiling functions, ⌊⌋ and ⌈⌉ respectively. The the number of multiples is given by the expression
⌊b/n⌋ - ⌈a/n⌉ + 1
For example, the multiples of 4 between 0 and 24 are {0, 4, 8, 12, 16, 20, 24}. To count them more quickly without having to list them, you compute
⌊24/4⌋ - ⌈0/4⌉ + 1
= 6 - 0 + 1
= 7
⌊b/n⌋ - ⌈a/n⌉ + 1
For example, the multiples of 4 between 0 and 24 are {0, 4, 8, 12, 16, 20, 24}. To count them more quickly without having to list them, you compute
⌊24/4⌋ - ⌈0/4⌉ + 1
= 6 - 0 + 1
= 7
Similar questions
Social Sciences,
8 months ago
English,
8 months ago
English,
8 months ago
Social Sciences,
1 year ago
English,
1 year ago