Skip to main content
2 of 5
formatting
Martin Ender
  • 8.8k
  • 1
  • 35
  • 61

Question about this Sieve of Eratosthenes graph

I googled for images of graphs and found nothing that even comes close to this one, so I want to experiment some more.

limc = 4;  
limv = Prime[limc + 1]^2 - 1;  
b = Table[1 -> 2 n + 1, {n, 1, limv/2 - 1}];  
a = Table[Prime[n] -> Prime[n] (m + 1), {n, 1, limc},
 {m, 1, limv/Prime[n] - 1}];  
GraphicsGrid[{{GraphPlot[b], GraphPlot[a[[1]]], GraphPlot[a[[2]]]},  
 {GraphPlot[a[[3]]], GraphPlot[a[[4]]],}}]  
  GraphPlot[Join[Flatten[a], b],  
  VertexRenderingFunction -> ({White, EdgeForm[Black], Disk[#, .1], 
      Black, Text[#2, #1]} &)]

List b represents the possible odd primes. List a is the 4 different prime cancellations.

The GraphicsGrid shows 5 radial graphs that we combine: 1 -> odd numbers, 2 -> evens, 3 -> multiples of 3, 5 -> multiples of 5, and 7 -> multiples of 7.

The graph of the first 4 primes up to limv is: Sieve of Eratosthenes Graph

You will notice the one points to many odd numbers that have only one connection. These are the primes.

My question: It there a method to retrieve parts of a graph from the graph object? I want those primes and the evens that also have no connections, so I can do more evaluation.

Fred Daniel Kline
  • 2.4k
  • 2
  • 20
  • 41