On Wed, 31 Mar 2010, Jean Legeande wrote:
< Dear Maxima users,
< ?
< What is a good way to?code the prime-counting function with Maxima ?
How about:
pi[n]:=if n = 2 then 1 elseif primep(n) then pi[n-1]+1 else pi[n-1] ;
I use a hash function so that we only ever need to compute pi[n] once,
for any n.
Leo
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.