結果

問題 No.3296 81-like number
ユーザー t5ugu
提出日時 2025-10-05 13:51:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 489 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 14,336 KB
最終ジャッジ日時 2025-10-05 13:52:50
合計ジャッジ時間 1,805 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = int(input())

def primes(x : int) -> list[int]:
    if x < 2:
        return []
    nums = [i for i in range(x)]
    nums[1] = 0

    for num in nums:
        if num == 0:
            continue
        for nonp in range(2 * num, x, num):
            nums[nonp] = 0
    return [p for p in nums if p != 0]

P = primes(int(math.sqrt(N)) + 1)
s = 0
for p in P:
    l = int(math.log(N, p)) + 1
    if l <= 2:
        continue
    s += int((p ** l - p ** 2) / (p - 1))

print(s)
0