Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,8 @@
Q := proc( n )
option remember, system;
if n = 1 or n = 2 then
1
else
thisproc( n - thisproc( n - 1 ) ) + thisproc( n - thisproc( n - 2 ) )
end if
end proc:

View file

@ -0,0 +1,5 @@
> seq( Q( i ), i = 1 .. 10 );
1, 1, 2, 3, 3, 4, 5, 5, 6, 6
> Q( 1000 );
502

View file

@ -0,0 +1,8 @@
> flips := 0:
> for i from 2 to 100000 do
> if L[ i ] < L[ i - 1 ] then
> flips := 1 + flips
> end if
> end do:
> flips;
49798

View file

@ -0,0 +1,15 @@
Qflips := proc( n )
local a := Array( 1 .. n );
a[ 1 ] := 1;
a[ 2 ] := 1;
for local i from 3 to n do
a[ i ] := a[ i - a[ i - 1 ] ] + a[ i - a[ i - 2 ] ]
end do;
local flips := 0;
for i from 2 to n do
if a[ i ] < a[ i - 1 ] then
flips := 1 + flips
end if
end do;
flips
end proc:

View file

@ -0,0 +1,2 @@
> Qflips( 10^5 );
49798