HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Forums > Discussion of problems > topic:


Problem "50575 - Number of Prime numbers"

There is a contest!

В настоящий момент идёт турнир. Некоторая информация и функции сервера недоступны до его окончания.

imesecanSep.29.2015 at 09:24:48 PM
0-- Test 1 ---
2 10

--- Pattern ---
4

imesecanDec.08.2015 at 11:12:53 AM
1It's faster if you check until the square root of the number.
while(divisor*divisor<=num)

You can also make faster than that.
if the number is 2, it's prime,
if it's not 2 and if the number is divisible by two, it's not prime,
otherwise start from 3 and check for only odd numbers until the square root of the numbers.


www.contester.ru