Given two numbers, N and d as an input. Print the sum of all N digit prime numbers where the digit d appears the most. If, for example, N=4 and d=0, then the sum of all possible numbers is 67061, which includes 1009, 2003, 3001, 4001, 4003, 4007, 5003, 5009, 6007, 7001, 8009, 9001, and 9007. 26 There are many four-digit prime numbers that contain single 0's in them but they are not taken into consideration as they do not have' number of times. Read the input from STDIN and print the output to STDOUT. Do not print arbitrary strings anywhere in the program, as these contribute to the standard output am test cases will fail. Delo, Adviccurring maximum 4 Constraints: N (1 ≤N≤10¹8) UU CH65335 Input Format: The first line of input contains T, number of test cases. The next T lines of input contain, N and d, denoting the number of digits a prime number should have and a number that should be repeating in it, respectively. N and d are separated by a single white-space. Sample Input1: 2 30 41 Output Format: The output must display the sum of all N digit prime numbers where the digit d appears the most. print the output in T separate lines as per the order of input Sample Output1: 6883 22275
Given two numbers, N and d as an input. Print the sum of all N digit prime numbers where the digit d appears the most. If, for example, N=4 and d=0, then the sum of all possible numbers is 67061, which includes 1009, 2003, 3001, 4001, 4003, 4007, 5003, 5009, 6007, 7001, 8009, 9001, and 9007. 26 There are many four-digit prime numbers that contain single 0's in them but they are not taken into consideration as they do not have' number of times. Read the input from STDIN and print the output to STDOUT. Do not print arbitrary strings anywhere in the program, as these contribute to the standard output am test cases will fail. Delo, Adviccurring maximum 4 Constraints: N (1 ≤N≤10¹8) UU CH65335 Input Format: The first line of input contains T, number of test cases. The next T lines of input contain, N and d, denoting the number of digits a prime number should have and a number that should be repeating in it, respectively. N and d are separated by a single white-space. Sample Input1: 2 30 41 Output Format: The output must display the sum of all N digit prime numbers where the digit d appears the most. print the output in T separate lines as per the order of input Sample Output1: 6883 22275
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Please code in Java or C or C++ or C # or python 2 or 3 or R( Any one of the following)
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 1 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY