## Re: [PrimeNumbers] Order to products of Gaussian primes...

Expand Messages
• ... Hash: SHA1 I ve improved a bit on that heuristic. Consider my previous program (thinking in degrees not radians): it sorted and compared number based on
Message 1 of 6 , May 31, 2003
• 0 Attachment
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've improved a bit on that heuristic. Consider my previous program (thinking
in degrees not radians): it sorted and compared number based on the absolute
value of their angles, so 89 degrees would be considered bigger than 45
degrees. However. 45 degrees is the farthest one can get from either axis,
whereas 89 degrees is pretty close to an axis, and is actually equivalent to
1 degree. So I've updated my program to reflect that. While it also doesn't
give perfect results every time, at least not with randomly chosen gaussian
integers, it improves a bit on the previous heuristic, particularly as the
number of gaussian integers to consider goes up.

Décio

- ---------- cut here ----------
biggest(v) =
{
sz = matsize(v)[2];
m = matrix(sz,3,i,j,
if(j==1,
v[i]
,
if(real(v[i])!=0,
atan(imag(v[i])/real(v[i]))
,
Pi/2
)
);
);
for(i=1,sz,
if(m[i,2] > Pi/4,
m[i,3] = Pi/2 - m[i,2]
)
);
m = vecsort(m~,3,4)~;
cumprod = 1;
cumsum = 0;
for(count=1,sz,
phase = m[count,2];
orig = abs((cumsum+phase) % (Pi/2));
cnj = abs((cumsum-phase) % (Pi/2));
if(orig > Pi/4,
orig = Pi/2 - orig
);
if(cnj > Pi/4,
cnj = Pi/2 - cnj
);
print("orig = "orig" cnj = "cnj);
if(orig <= cnj,
print(m[count,1]);
cumsum = (cumsum + phase) % (2*Pi);
cumprod *= m[count,1];
,
print(conj(m[count,1]));
cumsum = (cumsum - phase) % (2*Pi);
cumprod *= conj(m[count,1]);
);
);
print("phase of result = "cumsum);
cumsum = cumsum % (Pi/2);
if(cumsum > Pi/4,
cumsum = Pi/2 - cumsum;
);
print("phase of result (reduced) = "cumsum);
print("result = "cumprod);
}
- ---------- cut here ----------

Décio
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE+2JdYce3VljctsGsRAi/MAJ0R/QExYTsr9iPFoYJD10qC97W1DACgsRAE
ZaEPvF7NaqttYWyjz8eDt9Q=
=2+Bz
-----END PGP SIGNATURE-----
Your message has been successfully submitted and would be delivered to recipients shortly.