September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,17 +1,18 @@
func is_k_almost_prime(n, k) {
for (var (p, f) = (2, 0); (f < k) && (p*p <= n); ++p) {
(n /= p; ++f) while p.divides(n);
(n /= p; ++f) while (p `divides` n)
}
n > 1 ? (f.inc == k) : (f == k)
}
5.times { |k|
{ |k|
var x = 10
say gather {
Math.inf.times { |i|
{ |i|
if (is_k_almost_prime(i, k)) {
take(i); (--x).is_zero && break;
take(i)
--x == 0 && break
}
}
} << 1..Inf
}
}
} << 1..5