Comment

Comment by cl3misch

> what if we just generate all products from the set of numbers 2:n and exclude those as "not prime" from all the numbers up to n?

It's fun to translate terse APL to somewhat terse numpy. The result still can be very compact and you can parse it easily if you're used to looking at numpy:

    s = arange(2, 50); p = outer(s, s).ravel(); sorted(set(s) - set(p))
parent cl3misch 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton