Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Finding Gaussian Primes

Subject: Finding Gaussian Primes

From: Jeff

Date: 23 Nov, 2009 19:06:19

Message: 1 of 3

For a school project, I need to find a list of Gaussian primes. These are primes of the form 4n+1 (so I'm told).

I can generate a list of primes using primes(n), and it's easy enough to generate a list of integers of the form 4n+1.

Is there a way to find the values which occur in both lists?

Thanks,
-Jeff

Subject: Finding Gaussian Primes

From: John D'Errico

Date: 23 Nov, 2009 19:32:04

Message: 2 of 3

"Jeff " <spREMOVEHITSjeffAT@SIGNoptonline.net> wrote in message <heemfb$9jn$1@fred.mathworks.com>...
> For a school project, I need to find a list of Gaussian primes. These are primes of the form 4n+1 (so I'm told).
>
> I can generate a list of primes using primes(n), and it's easy enough to generate a list of integers of the form 4n+1.
>
> Is there a way to find the values which occur in both lists?

What do you wish to do? Is this a set intersection
problem? Perhaps this is time for you to learn
about the lookfor function. So try this in matlab:

lookfor intersection

I'll bet it turns up something useful.

John

Subject: Finding Gaussian Primes

From: Jeff

Date: 23 Nov, 2009 21:22:19

Message: 3 of 3

"John D'Errico" <woodchips@rochester.rr.com> wrote in message <heenvk$f09$1@fred.mathworks.com>...
> "Jeff " <spREMOVEHITSjeffAT@SIGNoptonline.net> wrote in message <heemfb$9jn$1@fred.mathworks.com>...
> > For a school project, I need to find a list of Gaussian primes. These are primes of the form 4n+1 (so I'm told).
> >
> > I can generate a list of primes using primes(n), and it's easy enough to generate a list of integers of the form 4n+1.
> >
> > Is there a way to find the values which occur in both lists?
>
> What do you wish to do? Is this a set intersection
> problem? Perhaps this is time for you to learn
> about the lookfor function. So try this in matlab:
>
> lookfor intersection
>
> I'll bet it turns up something useful.
>
> John

Yes, I needed an intersection (for some reason I couldn't think of that word when posting). And the lookfor command was perfect for finding it. Thanks for the reply, John.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us