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

12 lines
353 B
APL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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]
}