Christian Hoffmann on Thu, 26 Sep 2013 13:47:55 +0200

 function result vector ?

• To: Pari-users@pari.math.u-bordeaux1.fr
• Subject: function result vector ?
• From: Christian Hoffmann <c-w.hoffmann@sunrise.ch>
• Date: Thu, 26 Sep 2013 13:47:41 +0200
• Delivery-date: Thu, 26 Sep 2013 13:47:56 +0200
• User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:17.0) Gecko/20130801 Thunderbird/17.0.8

```I have the following problem with a vector as a function result:

(Trying to split a prime of form 4k+1 into two squares)

twosquares(n) = \
local (r, p, q);\
{\
r=floor(sqrt(n));\
v=vector(2);\
v=[-1,0];\
forstep(p=r,0,-1, if(issquare(n-p^2,&q),{v=[p,q]; print(v); break}));\
\\forstep(p=r,0,-1, if(issquare(n-p^2,&q), break;));\
v=[p,q];\
print(p."  ",q)
return(v)
}

twosquares(17)
0   1
%50 = [0, 1]

instead of [4, 1] . ( 17 = 4^2 + 1^2 )

Christian

PS: Is there a rigorous definition of Pari syntax?

--
Christian W. Hoffmann,
CH - 8915 Hausen am Albis, Switzerland
Rigiblickstrasse 15 b, Tel.+41-44-7640853
(!! c-w.hoffmann@sunrise.ch, <will be eliminated in the near future,
instead Bitte nicht mehr benutzen !!, stattdessen: >)
mailto: christian@echoffmann.ch
home: www.echoffmann.ch

```