Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Calkin-Wilf-sequence/J/calkin-wilf-sequence-1.j
Normal file
21
Task/Calkin-Wilf-sequence/J/calkin-wilf-sequence-1.j
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
cw_next_term=: [: % +:@<. + -.
|
||||
|
||||
ccf =: compute_continued_fraction=: 3 :0
|
||||
if. 0 -: y do.
|
||||
, 0
|
||||
else.
|
||||
result=. i. 0
|
||||
remainder=. % y
|
||||
whilst. remainder do.
|
||||
remainder=. % remainder
|
||||
integer_part=. <. remainder
|
||||
remainder=. remainder - integer_part
|
||||
result=. result , integer_part
|
||||
end.
|
||||
end.
|
||||
)
|
||||
|
||||
molcf =: make_odd_length_continued_fraction=: (}: , 1 ,~ <:@{:)^:(0 -: 2 | #)
|
||||
|
||||
NB. base 2 @ reverse @ the cf's representation copies of 1 0 1 0 ...
|
||||
index_cw_term=: #.@|.@(# 1 0 $~ #)@molcf@ccf
|
||||
1
Task/Calkin-Wilf-sequence/J/calkin-wilf-sequence-2.j
Normal file
1
Task/Calkin-Wilf-sequence/J/calkin-wilf-sequence-2.j
Normal file
|
|
@ -0,0 +1 @@
|
|||
ccf=: _1 {"1 |.@(0 1 #: %@{.)^:(0~:{.)^:a:
|
||||
Loading…
Add table
Add a link
Reference in a new issue