RosettaCodeData/Task/Stern-Brocot-sequence/APL/stern-brocot-sequence.apl

12 lines
353 B
APL
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
task{
stern{{
0 :
(+1),(+/,2)2
}1 1}
seqstern 1200 ⍝ Cache 1200 elements
'First 15 elements:',15seq
'Locations of 1..10:',seq10
'Location of 100:',seq100
'All GCDs 1:','no' 'yes'[1+1.=2/1000seq]
}