Skip to content

Practice Find the Count of Numbers Which Are Not Special

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3233
LeetCode Problem

Find the Count of Numbers Which Are Not Special

Problem Statement

A proper divisor of x is a positive divisor other than x itself. Call x special when it has exactly two proper divisors; for example, 4 has the proper divisors 1 and 2, while 6 has three. Given l and r, count the integers in the inclusive interval [l, r] that are not special.

Source: Find the Count of Numbers Which Are Not Special on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
l = 5, r = 7
Output
3

# Example 2

Input
l = 4, r = 16
Output
11

Constraints

1 <= l <= r <= 10^9

Related LeetCode Problems

Practice more problems similar to Find the Count of Numbers Which Are Not Special.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.