$0 = N + 1 # $0,$1 := (N+1),(N/K); $1 = N / K $2 = N * N # $2,$3 := (N*N),(K*N); $3 = K * N while $0 > $1 # while $0>$1: $0 = $1 # $0,$1 := $1,(($1*$1+N*N)/(2*$1+K*N)); $4 = $1 * $1 $1 = 2 * $1 $4 = $4 + $2 $1 = $1 + $3 $1 = $4 / $1 end # end if M == 0 # if M==0: $4 = $0 * $0 # $4 := K*N*$0+N+$0+$0*$0; $4 = $4 + $0 $4 = $4 + N $3 = $3 * $0 $4 = $4 + $3 $5 = N - $0 # $5 := N*N+(2*(N-$0)-1)/K; $5 = $5 * 2 $5 = $5 - 1 $5 = $5 / K $5 = $5 + $2 if $4 > $5 # if $4>$5: $0 = $0 - 1 # $0 := $0 - 1; end # end end # end if M > 1 # if M>1: $6 = $0 + 1 # $6 := $0+1; $1 = M - 1 # $1 := M-1; $3 = $3 * $6 # $4 := K*N*$6+$6*$6+(2*(N-$6)+$1)*$1/K; $4 = N - $6 $4 = $4 * 2 $4 = $4 + $1 $4 = $4 * $1 $4 = $4 / K $4 = $4 + $3 $3 = $6 * $6 $4 = $4 + $3 $5 = N + $6 # $5 := N*N+$1*(N+$6); $5 = $5 * $1 $5 = $5 + $2 if $4 < $5 # if $4<$5: $0 = $0 + 1 # $0 := $0+1; end # end end # end $0 = $0 + N # return ($0+N); return $0