Submission #2665370


Source Code Expand

from itertools import count, islice

def eratosthenes():
    d = {}
    for q in count(2):
        p = d.pop(q, None)
        if p:
            x = next(x for x in count(q + p, p) if x not in d)
            d[x] = p
        else:
            yield q
            d[q*q] = q

n = int(input())

ones = (prime for prime in eratosthenes() if prime % 10 == 1)
n_ones = islice(ones, n)
print(' '.join(map(str, n_ones)))

Submission Info

Submission Time
Task D - Five, Five Everywhere
User zehnpaard
Language Python (3.4.3)
Score 400
Code Size 429 Byte
Status AC
Exec Time 19 ms
Memory 3064 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 5
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All in01.txt, in02.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
in01.txt AC 18 ms 3064 KB
in02.txt AC 19 ms 3060 KB
sample_01.txt AC 18 ms 3060 KB
sample_02.txt AC 18 ms 3064 KB
sample_03.txt AC 18 ms 3060 KB