Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,47 @@
|
|||
class Seq(terms, callback) {
|
||||
method next {
|
||||
terms += callback(terms)
|
||||
}
|
||||
|
||||
method nth(n) {
|
||||
while (terms.len < n) {
|
||||
self.next
|
||||
}
|
||||
terms[n-1]
|
||||
}
|
||||
|
||||
method first(n) {
|
||||
while (terms.len < n) {
|
||||
self.next
|
||||
}
|
||||
terms.first(n)
|
||||
}
|
||||
}
|
||||
|
||||
func next_EKG (s) {
|
||||
2..Inf -> first {|k|
|
||||
!(s.contains(k) || s[-1].is_coprime(k))
|
||||
}
|
||||
}
|
||||
|
||||
func EKG (start) {
|
||||
Seq([1, start], next_EKG)
|
||||
}
|
||||
|
||||
func converge_at(ints) {
|
||||
var ekgs = ints.map(EKG)
|
||||
|
||||
2..Inf -> first {|k|
|
||||
(ekgs.map { .nth(k) }.uniq.len == 1) &&
|
||||
(ekgs.map { .first(k).sort }.uniq.len == 1)
|
||||
}
|
||||
}
|
||||
|
||||
for k in [2, 5, 7, 9, 10] {
|
||||
say "EKG(#{k}) = #{EKG(k).first(10)}"
|
||||
}
|
||||
|
||||
for arr in [[5,7], [2, 5, 7, 9, 10]] {
|
||||
var c = converge_at(arr)
|
||||
say "EKGs of #{arr} converge at term #{c}"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue