2
$\begingroup$

I am currently learning my way through Mathematica and have stumbled upon a strange problem. It is asking me to implement PrimeQ into Graphics3D (specifically for spheres). I typed it up and displayed a picture in the notebook uploaded at the link below. If someone could explain this to me, I would greatly appreciate it and will move on to the next chapter, Pure Functions.

Disregard the input I entered. I was just trying a generic example to see how both compare in front of each other.

http://ge.tt/4Xi1kvZ1/v/0?c

P.S. I'm only 14 years old. I'm working through a Mathematica book, so that I may use Mathematica to enter into the Intel or Semmes Science Fairs next year.

$\endgroup$
  • $\begingroup$ Prime /@ Range@PrimePi[1000] gives you the prime numbers ... now you should solve how to "number" the 3D cells from 1 to 1000 ... $\endgroup$ – Dr. belisarius Apr 16 '14 at 1:37
  • $\begingroup$ Thank you for your speedy response. The prime numbers from 1 to 1000 is rather easy, although I would've used Select from Table OR Case from Table. The problem I am having is exactly the one you mentioned. Numbering the cells. Once I figure how to assign each coordinate to a specific number, I ought to be able to use Graphics3D and define Spheres at those coordinates. Also, I think the radius of the spheres is 1/2. Can somebody please confirm that? $\endgroup$ – mildused Apr 16 '14 at 1:41
  • 1
    $\begingroup$ Try Graphics3D[Table[If[PrimeQ[100 i + 10 j + k + 1], Sphere[{i, j, k}, 1/2]], {i, 0, 9}, {j, 0, 9}, {k, 0, 9}]] $\endgroup$ – Dr. belisarius Apr 16 '14 at 1:58
  • $\begingroup$ Why did you range the i,j,k to only nine? Why should it not range to 10? Otherwise, it looks the same. Thanks so much. $\endgroup$ – mildused Apr 16 '14 at 2:08
  • $\begingroup$ Try Flatten@Table[100 i + 10 j + k + 1, {i, 0, 9}, {j, 0, 9}, {k, 0, 9}] and Flatten@Table[100 i + 10 j + k + 1, {i, 1, 10}, {j, 1, 10}, {k, 1, 10}] $\endgroup$ – Dr. belisarius Apr 16 '14 at 2:12
2
$\begingroup$

How about:

IntegerDigits[Prime /@ Range@PrimePi[1000], 10, 3] // ListPointPlot3D
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.