Question bank › Math
Dsa Math Medium

Divisor Count Threshold

Develop a function that counts how many integers from 1 to N have exactly D divisors. Write a program that reads two integers N and D from the input and prints the count. For example, if N is 10 and D is 4, the integers are [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]. Only the number 6 has exactly 4 divisors (1, 2, 3, 6). Hence, the output is 1. Input Format: - Two integers N and D (1 <= N <= 10^6, 1 <= D <= 100). Output Format: - A single integer: the count of numbers with exactly D divisors. Example: Input: 10 4 Output: 1

Key concepts

mathdivisorscount

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.