Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Prime Spiral' topicStudent Support Forum > General > "Prime Spiral"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
08/23/12 12:18pm

Is one of these what you are looking for?

In[1]:= n=20;
(*Create list of first n primes*)
primes=Select[Range[Prime[n]],PrimeQ];
(*Display the points*)
Show[
Graphics[Table[Point[primes[[i]]*{Cos[(i-1)*Pi/2],Sin[(i-1)*Pi/2]}],{i,Length[primes]}]]
]

<<<graphic snipped>>>

In[4]:= n=20;
(*Create list of first n primes*)
primes=Select[Range[Prime[n]],PrimeQ];
(*Display the points with connecting lines*)
Show[
Graphics[Table[Point[primes[[i]]*{Cos[(i-1)*Pi/2],Sin[(i-1)*Pi/2]}],{i,Length[primes]}]],
Graphics[Line[Table[primes[[i]]*{Cos[(i-1)*Pi/2],Sin[(i-1)*Pi/2]},{i,Length[primes]}]]]
]

<<<graphic snipped>>>

Try substituting n=1000 and stretch the graphic so it is large enough to not just be a black blob.

URL: ,

Subject (listing for 'Prime Spiral')
Author Date Posted
Prime Spiral Chris 08/22/12 6:16pm
Re: Prime Spiral Bill Simpson 08/23/12 12:18pm
< Previous CommentHelp | Reply To Comment | Reply To Topic