[seqfan] Re: PrimeQ and Gaussian integers

Neil Sloane njasloane at gmail.com
Wed May 10 06:05:46 CEST 2023


Robert I.: thanks for catching and correcting this error.  Robert G Wilson
used to be a member of this list, and if he still is, I hope he will
respond. I will try to copy this message to him.

You point out that there may be similar errors in other sequences.  Indeed,
if you enter
Gaussian prime Robert G. Wilson
in the OEIS search window, you get 36 matches.  But it may be that most of
the Mathematica programs have already been corrected (I don't know the
language well enough to be certain).

Best regards
Neil

Neil J. A. Sloane, Chairman, OEIS Foundation.
Also Visiting Scientist, Math. Dept., Rutgers University,
Email: njasloane at gmail.com



On Tue, May 9, 2023 at 10:50 AM <sven-h.simon at gmx.de> wrote:

> Hello,
> PARI too factors in GaussianPrimes only, when the number has an imaginary
> part, an easy solution is to multiply the whole number with I in this
> case.
> Sven
>
> -----Ursprüngliche Nachricht-----
> Von: SeqFan <seqfan-bounces at list.seqfan.eu> Im Auftrag von
> israel at math.ubc.ca
> Gesendet: Dienstag, 9. Mai 2023 05:43
> An: seqfan at list.seqfan.eu
> Betreff: [seqfan] PrimeQ and Gaussian integers
>
> Today I submitted a correction to A058770, but I suspect the issue might
> affect other sequences as well. A058770 is "Numbers n such that n *
> (1+i)^n
> + 1 is a Gaussian prime". The current Data section has 1, 2, 3, 5, 9,
> + 19,
> 20, 29, 30, 68, 142, 143, 150, 159, 160, 198, 468, 782, 858, 1100, 1137,
> 3337, 3638, 3909, 4845, 16895, 21768, 30349, 42692, 48470, 65208, but I
> have
> removed 160, 21768, and 65208. There is Mathematica code:
>
>  Do[ If[ PrimeQ[ n * (1 + I)^n + 1], Print[n] ], {n, 1, 4000} ]
>
> Although I'm not a Mathematica expert, I think the problem is this: PrimeQ,
> when given an argument that is an ordinary (i.e. rational) integer, will
> test whether that argument is a (rational) prime; when given a Gaussian
> integer that is not an ordinary integer, it will test for a Gaussian
> prime.
> The trouble here is that for the three values n = 160, 21768, and 65208, n
> * (1+i)^n + 1 is a (rational) prime == 1 (mod 4), and therefore by Fermat
> is
> not a Gaussian prime. The point is that PrimeQ does not see the I in its
> input, only the result of expanding out the (1 + I)^n, which is a rational
> integer when n is even, and so it only tests for a rational prime. I think
> the fix would be to insert the option GaussianIntegers -> true in the call
> to PrimeQ.
>
> Cheers,
> Robert
>
> --
> Seqfan Mailing list - http://list.seqfan.eu/
>
>
> --
> Seqfan Mailing list - http://list.seqfan.eu/
>


More information about the SeqFan mailing list