September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1,8 +1,8 @@
|
|||
func Q(n) is cached {
|
||||
n <= 2 ? 1
|
||||
: Q(n - Q(n-1))+Q(n-Q(n-2))
|
||||
n <= 2 ? 1
|
||||
: Q(n - Q(n-1))+Q(n-Q(n-2))
|
||||
}
|
||||
|
||||
say "First 10 terms: #{10.of {|n| Q(n) }.dump }"
|
||||
|
||||
say "First 10 terms: #{ {|n| Q(n) }.map(1..10) }"
|
||||
say "Term 1000: #{Q(1000)}"
|
||||
say "Terms less than preceding in first 100k: #{2..100000->count{|i|Q(i)<Q(i-1)}}"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
var Q = [0, 1, 1];
|
||||
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 "First 10 terms: #{Q.ft(1, 10)}"
|
||||
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