Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
|
|
@ -0,0 +1,21 @@
|
|||
proc hofstadter limit . q[] .
|
||||
q[] = [ 1 1 ]
|
||||
for n = 3 to limit
|
||||
q[] &= q[n - q[n - 1]] + q[n - q[n - 2]]
|
||||
.
|
||||
.
|
||||
proc count . q[] cnt .
|
||||
for i = 2 to len q[]
|
||||
if q[i] < q[i - 1]
|
||||
cnt += 1
|
||||
.
|
||||
.
|
||||
.
|
||||
hofstadter 100000 hofq[]
|
||||
for i = 1 to 10
|
||||
write hofq[i] & " "
|
||||
.
|
||||
print ""
|
||||
print hofq[1000]
|
||||
count hofq[] cnt
|
||||
print cnt
|
||||
10
Task/Hofstadter-Q-sequence/SETL/hofstadter-q-sequence.setl
Normal file
10
Task/Hofstadter-Q-sequence/SETL/hofstadter-q-sequence.setl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
program hofstadter_q;
|
||||
q := [1,1];
|
||||
loop for n in [3..100000] do
|
||||
q(n) := q(n-q(n-1)) + q(n-q(n-2));
|
||||
end loop;
|
||||
|
||||
print("First 10 terms: " + q(1..10));
|
||||
print("1000th term: " + q(1000));
|
||||
print("q(x) < q(x-1): " + #[x : x in [2..#q] | q(x) < q(x-1)]);
|
||||
end program;
|
||||
Loading…
Add table
Add a link
Reference in a new issue