Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Stern-Brocot-sequence/APL/stern-brocot-sequence.apl
Normal file
11
Task/Stern-Brocot-sequence/APL/stern-brocot-sequence.apl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
task←{
|
||||
stern←{⍵{
|
||||
⍺←0 ⋄ ⍺⍺≤⍴⍵:⍺⍺↑⍵
|
||||
(⍺+1)∇⍵,(+/,2⊃⊣)2↑⍺↓⍵
|
||||
}1 1}
|
||||
seq←stern 1200 ⍝ Cache 1200 elements
|
||||
⎕←'First 15 elements:',15↑seq
|
||||
⎕←'Locations of 1..10:',seq⍳⍳10
|
||||
⎕←'Location of 100:',seq⍳100
|
||||
⎕←'All GCDs 1:','no' 'yes'[1+1∧.=2∨/1000↑seq]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue