Yeah I actually think this may be the secret underlying link between all the prime numbers. There is probably some criteria for the p and q that go into the web function to generate primes that I haven't discovered yet.
Not that I can think of. Check this output:
>>> makeTree(85)
85
9
3
1
[[[1, 2], 0], [1, 0]]
>>> web(1,2)
(1, 2) (1, 2)
1, 2 2 [2] 2
2, 2 3 [3] 3
(2, 3)
>>> web(3,0)
(3, 0) (3, 0)
3, 0 3 [3] 3
0, 0 0 [] 0
(3, 0)
>>> web(3,1)
(3, 1) (3, 1)
3, 3 5 [5] 5
1, 3 3 [3] 3
(5, 3)
>>> makeTree(7*19)
[[[1, 2], [1, 0]], [1, 2]]
>>> web(1,2)
(1, 2) (1, 2)
1, 2 2 [2] 2
2, 2 3 [3] 3
(2, 3)
>>> web(1,3)
(1, 3) (1, 3)
1, 3 3 [3] 3
3, 3 5 [5] 5
(3, 5)
>>> web(1,5)
(1, 5) (1, 5)
1, 5 7 [7] 7
5, 5 11 [11] 11
(7, 11)
>>> makeTree(13*61)
[[[1], [1, 2]], [3]]
>>> web(1,2)
(1, 2) (1, 2)
1, 2 2 [2] 2
2, 2 3 [3] 3
(2, 3)
>>> web(1,3)
(1, 3) (1, 3)
1, 3 3 [3] 3
3, 3 5 [5] 5
(3, 5)
>>> web(5,3)
(5, 3) (5, 3)
5, 15 61 [61] 1
3, 15 59 [59] 59
(61, 59)
So for some of these if you extrapolate out you can generate the correct factor through this. Some examples don't work but I'm not completely deterred because maybe my trees are terminating too quickly or something idk