#P5723. Prime Bag Loading
Prime Bag Loading
Prime Bag Loading
Little A has a special bag that can only hold prime numbers. Beginning with \(2\), he checks each natural number in order. If the number is prime, it is added to the bag. The load of the bag is defined as the sum of all the prime numbers it contains. However, the bag has a weight limit: the sum of the primes must not exceed \(L\).
Your task is: Given \(L\), determine how many prime numbers can be placed into the bag. Output these primes in increasing order, each on a separate line, and finally output the count of the primes added (also on a new line).
Note: All formulas are written in \(\LaTeX\) format.
inputFormat
The input consists of a single integer \(L\) (the maximum allowable sum).
outputFormat
Output the selected prime numbers in increasing order on separate lines. On the last line, output the number of primes that were added.
sample
1
0