Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
|||
var primes = 10_000_019.primes
|
||||
|
||||
var (*strong, *weak, *balanced)
|
||||
|
||||
for k in (1 ..^ primes.end) {
|
||||
var p = primes[k]
|
||||
|
||||
given((primes[k-1] + primes[k+1])/2) { |x|
|
||||
case (x > p) { weak << p }
|
||||
case (x < p) { strong << p }
|
||||
else { balanced << p }
|
||||
}
|
||||
}
|
||||
|
||||
for pr, type, d, c1, c2 in [
|
||||
[ strong, 'strong', 36, 1e6, 1e7],
|
||||
[ weak, 'weak', 37, 1e6, 1e7],
|
||||
[balanced, 'balanced', 28, 1e6, 1e7],
|
||||
] {
|
||||
say ("\nFirst #{d} #{type} primes:\n", pr.first(d).map{.commify}.join(' '))
|
||||
say ("Count of #{type} primes <= #{c1.commify}: ", pr.first_index { _ > 1e6 }.commify)
|
||||
say ("Count of #{type} primes <= #{c2.commify}: " , pr.len.commify)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue