Fastest-in term of space- way to find prime numbers with python

后端 未结 4 1511
温柔的废话
温柔的废话 2020-11-30 13:21

Maybe it is a stupid question, but i was wondering if you could provide the shortest source to find prime numbers with Python. I was also wondering how to find prime numbers

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 14:13

    Since one can just cut and paste the first million primes from the net:

    map(int,open('primes.txt'))
    

    This is a somewhat similar to the question I asked yesterday where wim provided a fairly short answer:

    is this primes generator pythonic

提交回复
热议问题