Help mathematical shell programming

view story

http://www.unix.com – Hello Guys,For my homework I must write a shell script to do this serie, I know that I must use the "bc" for that, but for the script's itself i have no idea,(beginner) Can you plz just help me for have some idea? Thanks I wrote a program baut it does not work, #!/bin/sh echo "Input number" read n counter=0 ans=1 while [ $counter -ne $n ] do ans=`expr 4*(-1/(2*$counter+1))`| bc -l counter=`expr counter+1` done echo "the sum of the series is :-$ans" any suggestion could help me a lot Thanks (HowTos)