×

# DEBNPRM - Editorial

Tester: Debjit Datta

Easy

## Prerequisites:

Dynamic Programming, Prime-sieve

## Explanation:

Given a number, we have to find if its prime. If not we add the first prime number to it and check if its prime and then the second and so on until the sum becomes prime.

We use prime sieve and store all the prime numbers as false in a boolean array and composite numbers as true. Along with that we keep a list of all prime numbers upto 10^7. We check if the given number is prime and if not, we add the first number from the list to it and check again. The process goes on until we find a prime number.

## Author’s and Tester’s Solution:

Author’s solution is here

Tester's solution is here

This question is marked "community wiki".

534
accept rate: 0%

 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×2,085
×301
×12

question asked: 02 Apr '18, 23:13

question was seen: 150 times

last updated: 02 Apr '18, 23:14