Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
|
|
@ -0,0 +1,8 @@
|
|||
func Q(n) is cached {
|
||||
n <= 2 ? 1
|
||||
: Q(n - Q(n-1))+Q(n-Q(n-2))
|
||||
}
|
||||
|
||||
say "First 10 terms: #{10.of {|n| Q(n) }.dump }"
|
||||
say "Term 1000: #{Q(1000)}"
|
||||
say "Terms less than preceding in first 100k: #{2..100000->count{|i|Q(i)<Q(i-1)}}"
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
var Q = [0, 1, 1];
|
||||
100_000.times {
|
||||
Q << (Q[-Q[-1]] + Q[-Q[-2]])
|
||||
}
|
||||
|
||||
say "First 10 terms: #{Q.ft(1, 10).dump}"
|
||||
say "Term 1000: #{Q[1000]}"
|
||||
say "Terms less than preceding in first 100k: #{2..100000->count{|i|Q[i]<Q[i-1]}}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue