Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
var limit = 1e6
|
||||
var primes = limit.primes
|
||||
|
||||
say "Groups of successive primes <= #{limit.commify}:"
|
||||
|
||||
for diffs in [[2], [1], [2,2], [2,4], [4,2], [6,4,2]] {
|
||||
|
||||
var groups = []
|
||||
primes.each_cons(diffs.len+1, {|*group|
|
||||
if (group.map_cons(2, {|a,b| b-a}) == diffs) {
|
||||
groups << group
|
||||
}
|
||||
})
|
||||
|
||||
say ("...for differences #{diffs}, there are #{groups.len} groups, where ",
|
||||
"the first group = #{groups.first} and the last group = #{groups.last}")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue