RSA Numbers
InterviewTime limit1sMemory limit128 MB
Count how many integers in an inclusive range below 1000 have exactly four divisors, then print the count in a fixed sentence.
- Level
Easy3 of 10
- Topics
- Math, Number theory, Brute force, Implementation
- Solved
- No attempts yet
Problem
A number is an RSA number if it has exactly four divisors — that is, exactly four positive integers divide it evenly. For example, is an RSA number because it has exactly four divisors (). is not an RSA number because it has too many divisors (), and is not one either (its only divisors are and ). So there is exactly one RSA number in the range .
Write a program that reads a range of numbers and counts how many numbers in that range are RSA numbers. You may assume that every number in the range is less than .
(The name comes from the RSA encryption that many web browsers use to protect information such as credit-card numbers sent over the Internet.)
Input
Two integers and () are given: the inclusive lower and upper bounds of the range. Each number is less than .
Output
Print a single line in exactly the following form:
The number of RSA numbers between a and b is c
where and are the given bounds and is the number of RSA numbers in the range .