## Next Prime (Hard)

View as PDFSubmit solution

Points:15

Time limit:2.0s

Memory limit:64M

Problem type

Allowed languages

Ada, Assembly, Awk, Brain****, C, C++, COBOL, CommonLisp, Dart,
~~Erlang~~,
~~Forth~~, Fortran,
~~Intercal~~,
~~Octave~~, Pascal, Prolog,
~~R~~, Racket, Rust,
~~Scheme~~, Sed, TCL, Text, Turing,
~~VB~~

##### Brute Force Practice 3 — Hard Version

You love prime numbers. You own a number, but you suspect it might not be prime. You want a prime number, but it must be at least as large as the number you currently own. Find the smallest number that satisfies those conditions.

#### Input

The first line will have the integer ()

#### Output

Print the number you want.

#### Sample Input

`4`

#### Sample Output

`5`

## Comments

Hintcan I have any hints?

keep getting WA MLE and TLE.

Your code is wrong, takes up too much memory, and is too slow.

Why is java disabled?

`java.math.BigInteger`

has a method called`isProbablePrime()`

, which would trivialize the problem.I think there might be a problem with the online grader cuz I got the results for test cases 1 to 10:

and in my submissions, it says my time is 0.09s. I calculated the average to be 0.009s, so I think the grader is multiplying by 10 for some reason.

I did not misread the decimal places btw. Thanks!

The time is the total time, not the average

oops

What is submitting code in python not allowed for this problem?

Can we have Python <3

Cus we dont liek python........ its bad... :P

Partial output is disabled for this problem.