March 2014 update
This commit is contained in:
parent
09687c4926
commit
a25938f123
1846 changed files with 21876 additions and 5203 deletions
|
|
@ -0,0 +1,20 @@
|
|||
SetBatchLines, -1
|
||||
Q := HofsQSeq(100000)
|
||||
|
||||
Loop, 10
|
||||
Out .= Q[A_Index] ", "
|
||||
|
||||
MsgBox, % "First ten:`t" Out "`n"
|
||||
. "1000th:`t`t" Q[1000] "`n"
|
||||
. "Flips:`t`t" Q.flips
|
||||
|
||||
HofsQSeq(n) {
|
||||
Q := {1: 1, 2: 1, "flips": 0}
|
||||
Loop, % n - 2 {
|
||||
i := A_Index + 2
|
||||
, Q[i] := Q[i - Q[i - 1]] + Q[i - Q[A_Index]]
|
||||
if (Q[i] < Q[i - 1])
|
||||
Q.flips++
|
||||
}
|
||||
return Q
|
||||
}
|
||||
|
|
@ -3,11 +3,11 @@ import std.stdio, std.algorithm, std.range, std.array;
|
|||
struct Q {
|
||||
__gshared static Appender!(uint[]) s;
|
||||
|
||||
/*nothrow*/ static this() {
|
||||
nothrow static this() {
|
||||
s ~= [0, 1, 1];
|
||||
}
|
||||
|
||||
static uint opCall(in int n) /*nothrow*/
|
||||
static uint opCall(in int n) nothrow
|
||||
in {
|
||||
assert(n > 0);
|
||||
} body {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
(de q (N)
|
||||
(cache '(NIL) (pack (char (hash N)) N)
|
||||
(cache '(NIL) N
|
||||
(if (>= 2 N)
|
||||
1
|
||||
(+
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue