Farey sequence



Barton Willis pisze:
> -----maxima-bounces at math.utexas.edu wrote: -----
> 
>> I have found :
> 
>> http://magma.maths.usyd.edu.au/magma/Examples/node6.html
> 
> A Maxima implementation of the third method is 
> 
>   ff(n) := setify(xreduce('append, makelist(makelist(i/j,i,0,j), j,1, n)));
> 
> I can think of ways that might speed this up--say n = 10. Then the inner makelist
> could skip j = 2 and j = 5, for example. But then the code would no longer be a
> one-liner :(
> 
> --Barton
Evaluation Farey(100) took 2.6700 seconds (2.6700 elapsed)

Evaluation ff(100) took 0.1300 seconds (0.1300 elapsed)

Great

... but ( just asking ) :
you still use lists ( makelist and append)
and after computing convert list to set ( setify).




Adam