$0=N+1 $1=N/K $2=N*N $3=K*N ifK==1 $1=N*10946 $1=$1/17711 end while$0>$1 $0=$1 $4=$1*$1 $1=2*$1 $4=$4+$2 $1=$1+$3 $1=$4/$1 end $0=$0+N return$0