#SP0000111. Dãy bán nguyên tố chẵn dài nhất (Even Semiprime Runs)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Dãy bán nguyên tố chẵn dài nhất (Even Semiprime Runs)
Even Semiprime Runs
Source: SPOJ
Version: Phuoc Hung OJ Extended
Problem Statement
A semiprime is a positive integer that is a product of exactly two primes, which may be equal. Examples include , , and . List all semiprimes of the inclusive interval in increasing order. A run is a contiguous subsequence of this semiprime list: its numerical values need not be consecutive integers. An even run contains only even semiprimes. Find the longest even run; if several qualify, choose the one with the smallest first member. It is guaranteed that at least one even semiprime is present in the interval.
Input
One line contains integers .
Output
Print two lines: the length of the chosen run, then its members in increasing order separated by single spaces.
Subtasks
- Subtask 1 (20 points): ; ; at least one even semiprime lies in the interval.
- Subtask 2 (30 points): ; ; at least one even semiprime lies in the interval.
- Subtask 3 (50 points): ; ; at least one even semiprime lies in the interval.
Examples
Input
1 1000
Output
3
454 458 466
Explanation
, , and are all even semiprimes. No other semiprime occurs between successive members of this run, so they form a contiguous run of length in the semiprime list. There is no longer even run in .