Ruud H.G. van Tol on Mon, 04 Nov 2024 09:36:34 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Is there a simpler way to get all 8 gaussian integers with same norml2() ? |
On 2024-11-04 01:03, hermann@stamm-wilbrandt.de wrote:
On 2024-11-03 21:58, Ruud H.G. van Tol wrote:On 2024-11-03 21:39, Bill Allombert wrote:On Sun, Nov 03, 2024 at 04:00:16PM +0100, hermann@stamm-wilbrandt.de wrote:? id(c)=c; ? neg(x)=-x; ? flip(c)=I*conj(c); ? c=7+4*I;vecsort([f(g(h(c)))|f<-[id,conj];g<-[id,neg];h<-[id,flip]])[-7 - 4*I, -7 + 4*I, -4 - 7*I, -4 + 7*I, 4 - 7*I, 4 + 7*I, 7 - 4*I, 7 + 4*I]I suggest [w*z | w<-powers(I,3); z<-[c,conj(c)]]Another one: vecsort(concat(c*=[-1,1,-I,I], conj(c)),,8) (assuming that duplicates are undesired)Thanks for all who answered, so many different ways.My subject was misleading, what I was interested in was one gaussian prime.And for that exactly 8 values exist, no duplicates possible. Since "powers(I,3)" as well "[-1,1,-I,I]" both have 11 characters, I like joining Bill's "powers" and Ruud's "*=" solution as shortest: ? c=4+I*7; ? concat(c*=powers(I,3),conj(c))[4 + 7*I, -7 + 4*I, -4 - 7*I, 7 - 4*I, 4 - 7*I, -7 - 4*I, -4 + 7*I, 7 + 4*I]?
The noisy side is that it changes c. Further it is good to use lexicals: my(c=4+I*7, t=powers(I,3)*c); concat(t, conj(t)) -- Ruud