5.7k views
5 votes
Here is another crazy definition involving integers N and M. Assume 0<=N and 0div( N, M ) = 0, if N < M

div( N, M ) = 1 + div( N-M, M ), if N >= M
What is div( 7, 5 ) ?

User Mgoffin
by
6.7k points

1 Answer

3 votes

Final answer:

To calculate div(7, 5), we follow the given definition of the function div(N, M).

Step-by-step explanation:

The question defines the function div(N, M) as follows:

  • If N is less than M, then div(N, M) = 0.
  • If N is greater than or equal to M, then div(N, M) = 1 + div(N-M, M).

To find div(7, 5), we check if 7 is greater than or equal to 5. Since it is, we calculate div(7-5, 5) = div(2, 5). Since 2 is less than 5, we have div(2, 5) = 0. Therefore, div(7, 5) = 1 + 0 = 1.

User Prakash Bhagat
by
7.3k points