/
EugenyCh7
/
CodeDOMTest
Обзор
Документация
Войти
/
EugenyCh7
/
CodeDOMTest
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
InstructionEncoderTest
Sample/Primes.cs
30 строк
615 B
eugenych
+ Sample
05 авг 2023, 11:36
05 авг 2023, 11:36
d148270
Код
Авторство
О чём код?
namespace Sample { public static class Primes { public static int Next(int x) { if (x < 2) return 2; if (x == 2) return 3; if ((x & 1) == 0) return x + 1; x += 2; int d = 3; while (d * d <= x) { if (x % d == 0) { x += 2; d = 3; } else { d += 2; } } return x; } } }