ℹ️Как компьютеры находят простые числа в тысячи раз быстрее, чем ты на бумажке
📌 Что делает решето Эратосфена
Находит все простые числа от 1 до N — быстро, эффективно и без перебора делителей. ➡️ Как это работает
▪️ Создаём массив от 2 до N
▪️ Берём первое невычеркнутое число p
▪️ Вычеркиваем все кратные p
▪️ Переходим к следующему невычеркнутому числу
▪️ Повторяем, пока p² <= N
Пример на Python:
def eratosthenes(n): sieve = [True] * (n+1) sieve[0:2] = [False, False] for i in range(2, int(n**0.5) + 1): if sieve[i]: for j in range(i*i, n+1, i): sieve[j] = False return [i for i, prime in enumerate(sieve) if prime]
ℹ️Как компьютеры находят простые числа в тысячи раз быстрее, чем ты на бумажке
📌 Что делает решето Эратосфена
Находит все простые числа от 1 до N — быстро, эффективно и без перебора делителей. ➡️ Как это работает
▪️ Создаём массив от 2 до N
▪️ Берём первое невычеркнутое число p
▪️ Вычеркиваем все кратные p
▪️ Переходим к следующему невычеркнутому числу
▪️ Повторяем, пока p² <= N
Пример на Python:
def eratosthenes(n): sieve = [True] * (n+1) sieve[0:2] = [False, False] for i in range(2, int(n**0.5) + 1): if sieve[i]: for j in range(i*i, n+1, i): sieve[j] = False return [i for i, prime in enumerate(sieve) if prime]
Telegram Android app: Open the chats list, click the menu icon and select “New Channel.” As the broader market downturn continues, yelling online has become the crypto trader’s latest coping mechanism after the rise of Goblintown Ethereum NFTs at the end of May and beginning of June, where holders made incoherent groaning sounds and role-played as urine-loving goblin creatures in late-night Twitter Spaces. As of Thursday, the SUCK Channel had 34,146 subscribers, with only one message dated August 28, 2020. It was an announcement stating that police had removed all posts on the channel because its content “contravenes the laws of Hong Kong.” How to Create a Private or Public Channel on Telegram? End-to-end encryption is an important feature in messaging, as it's the first step in protecting users from surveillance.
from us