Hi everybody—today's "homework" question:
Part 1:
Use PrimePi and SparseArray's ability to specify elements via patterns to generate the following (10x10) matrix:
{{1, 2, 0, 0, 0, 0, 0, 0, 0, 0}, {2, 2, 3, 0, 0, 0, 0, 0, 0, 0}, {0,
3, 3, 4, 0, 0, 0, 0, 0, 0}, {0, 0, 4, 4, 4, 0, 0, 0, 0, 0}, {0, 0,
0, 4, 4, 5, 0, 0, 0, 0}, {0, 0, 0, 0, 5, 5, 6, 0, 0, 0}, {0, 0, 0,
0, 0, 6, 6, 6, 0, 0}, {0, 0, 0, 0, 0, 0, 6, 6, 7, 0}, {0, 0, 0, 0,
0, 0, 0, 7, 7, 8}, {0, 0, 0, 0, 0, 0, 0, 0, 8, 8}}
Part 2:
Modify the code above such that it produces a 30x30 matrix rather than a 10x10 one, then create a graph which has the result as its adjacency matrix. (Try using a circular embedding for the graph layout.)