PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000060. Các số gần nguyên tố (Almost Prime Numbers)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Các số gần nguyên tố (Almost Prime Numbers)
Almost Prime Numbers
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
A positive integer is called an almost prime number if is not prime and all of its prime divisors are the same.
Equivalently, is almost prime if and only if there exist a prime number and an integer such that
For example, , , and are almost prime numbers, while is not.
Given two integers low and high, count the almost prime numbers satisfying
Input
The only line contains two integers low and high.
Output
Print one integer: the number of almost prime numbers in the closed interval .
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: .
Example
Input
1 10
Output
3
Explanation
The almost prime numbers in are
Hence the answer is .