100% Guaranteed Results


Project
$ 24.99
Category:

Description

5/5 – (1 vote)

This problem is a programming version of Problem 60 from projecteuler.net
The primes $3$, $7$, $109$, and $673$, are quite remarkable. By taking any two primes and concatenating them in any order the result will always be prime. For example, taking 7 and 109, both 7109 and 1097 are prime. The sum of these four primes, 792, represents the lowest sum for a set of four primes with this property.
Find the sum all set of $K-primes$ for which any two primes $(prime < N)$ concatenate to produce another prime. Print the sum in sorted order.
Input Format
Input contains two integers separated by a space $N$ $K$.
Output Format
Print the sum of $K-primes$, one in each line.
Constraints
$100 le N le 20000$
$3 le K le 5$
Sample Input
100 3
Sample Output
107
123
TL for this challenge has been adjusted as slow language like Python, PHP scaled by 1.8 times, Medium languages like Haskell are
scaled 1.4 times and fast languages remains as it is.
This challenge is tested to work in C++ and Python. If there are no submission in your preferred language feel free to write in
discussions page.

Reviews

There are no reviews yet.

Be the first to review “Project”

Your email address will not be published. Required fields are marked *

Related products