Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Code By replacing the 1 st digit of * 3 , it turns out that six of the nine possible values: 1 3 ,

Python Code
By replacing the 1st digit of *3, it turns out that six of the nine possible values: 13,23,43,53,73, and 83, are all prime.
By replacing the 3rd and 4th digits of 56**3 with the same digit, this 5-digit number is the first example having seven primes among the ten generated numbers, yielding the family: 56003,56113,56333,56443,56663,56773, and 56993. Consequently 56003, being the first member of this family, is the smallest prime with this property.
Find the smallest N-digit prime which, by replacing K-digits of the number (not necessarily adjacent digits) with the same digit, is part of an L prime value family.
Note1: It is guaranteed that solution does exist.
Note2: Leading zeros should not be considered.
Note3: If there are several solutions, choose the "lexicographically" smallest one (one sequence is considered "lexicographically" smaller than another if its first element which does not match the corresponding element in another sequence is smaller)
Input Format
Input contains three integers N, K and L.
Output Format
Print the first L numbers of the prime value family found in increasing order.
Constraints
2<=N<=7
1<=K<=N
1<=L<=8
Sample Input#00
527
Sample Output#00
56003561135633356443566635677356993
Sample Input#01
213
Sample Output#01
111317

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

Acceptance of the key role of people in this process of adaptation.

Answered: 1 week ago

Question

preference for well defined job functions;

Answered: 1 week ago