$0=K # $0 := K = U_2(K,-1); $1=K*K # $1 := K**2+2 = V_2(K,-1); $1=$1+2 $3=100000/K while$0<$3 # while $0<10**5/K: $0=$0*$1 # $0,$1 := ($0*$1),($1*$1-2) = U_{2n}(K,-1),V_{2n}(K,-1); (where n mod 2 = 0) $1=$1*$1 $1=$1-2 end # end $2=K*$0 # $0,$1 := ($0),((K*$0)+$1)/2 = U_{n}(K,-1),U_{n+1}(K,-1); (where n mod 2 = 0) $1=$1+$2 $1=$1/2 $3=1000000000/K while$1<=$3 # while $1<=10**9/K: $2=$1*K # $1,$0 := ((($1*K+$0)*K+$1),($1*K+$0)) $0=$2+$0 $2=$0*K $1=$1+$2 end # end $0=$0*N # return ($0*N/$1+N); $0=$0/$1 $0=$0+N return$0