RosettaCodeData/Task/Recamans-sequence/APL/recamans-sequence.apl

14 lines
399 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.

recaman{⎕IO0
genNext{
R[N-1]-N
(R<0)(R):,[N-1]+N
,[N-1]-N
}
'First 15: '
reca(genNext14),0
'First repetition: '
recagenNext{}reca
'Length of sequence containing [0..1000]:'
recagenNext{(1001).}reca
}