March 2014 update

This commit is contained in:
Ingy döt Net 2014-04-02 16:56:35 +00:00
parent 09687c4926
commit a25938f123
1846 changed files with 21876 additions and 5203 deletions

View file

@ -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
}

View file

@ -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 {

View file

@ -1,5 +1,5 @@
(de q (N)
(cache '(NIL) (pack (char (hash N)) N)
(cache '(NIL) N
(if (>= 2 N)
1
(+