結果

問題 No.3296 81-like number
ユーザー 回転
提出日時 2025-10-05 17:44:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 523 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 82,592 KB
実行使用メモリ 63,512 KB
最終ジャッジ日時 2025-10-05 17:44:59
合計ジャッジ時間 2,344 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

def sieve_of_eratosthenes(n):
    # https://af-e.net/python-sieve-of-eratosthenes/
    primes = [True] * (n + 1)
    p = 2
    while (p * p <= n):
        if primes[p]:
            for i in range(p * p, n + 1, p):
                primes[i] = False
        p += 1
    return [p for p in range(2, n + 1) if primes[p]]

ps = sieve_of_eratosthenes(int(N**(1/2))+100)
ans = 0
for p in ps:
    for exp in range(2,60):
        if(p**exp <= N):
            ans += p**exp
        else:
            break
print(ans)
0