Submit solution

Points:
15

Time limit:
1.0s

Memory limit:
64M

Problem type

Allowed languages

Ada, Assembly, Awk, Brain****, C, C++, COBOL, ~~CommonLisp~~, Dart, Forth, Fortran, Intercal, Lisp, ~~Octave~~, Pascal, Prolog, Python, 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

Can Java be allowed with BigInteger disabled? Like a+b hard.

Fermat primality test WA for case 13.

Edit: try dividing by first 100000 primes passes it

dividing by less than first 50k primes passes it

First 40k is enough

*38k

This comment is hidden due to too much negative feedback. Click here to view it.

~~PHP shouldn't be allowed on dmoj at all~~Why is there an AC Java 9 submission

This comment is hidden due to too much negative feedback. Click here to view it.

Look at the constraints on N. Also a tip you can use i*i<n instead of i<sqrt(n) to be sure that the calculations are precise.

i*i < n gives me a TLE

TLE means that your code is too slow.

Hintcan I have any hints?

keep getting WA MLE and TLE.

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

Thx man.

I'm probably just gonna learn some math.

Why is java disabled?

`java.math.BigInteger`

has a method called`isProbablePrime()`

, which would trivialize the problem.oh ok

This comment is hidden due to too much negative feedback. Click here to view it.

The time is the total time, not the average

This comment is hidden due to too much negative feedback. Click here to view it.

This comment is hidden due to too much negative feedback. Click here to view it.

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

Can we have Python <3

This comment is hidden due to too much negative feedback. Click here to view it.

This comment is hidden due to too much negative feedback. Click here to view it.

Partial output is disabled for this problem.