I think you could get a square-root reduction in the memory requirements by splitting the resistor networks in half. That's possible because you can topologically sort your network, oriented to the source- and sink- nodes. For a size-2N network, you can enumerate the two, size-N halves: two directed (1,k) resistor graphs (one source node + k nodes to join on); and zip together the (1,k) + (k,1) sets. (Correcting for the permutations of the k join nodes, and for source/sink symmetry).
Naively, it'd take O(n^2) memory to count all the NxN pairs; but, actually, you can do it in just O(n) space! You sort both half-networks by their resistance values, and then iterate the (implicit) sorted list of their Cartesian sums, in order, counting unique values. You can do that in O(n) space, using an O(n) min-heap and O(n^2 log n) time. The heap only goes up to O(n) because that's the number of possible "next" values at any step. Think of it as the NxN matrix M[i,j] = a[i]+b[j], with the rows and columns sorted (a,b sorted); the size of the "advancing front" from the min-corner to the max-corner is O(n).
edit to add: I screwed up; there isn't a usefully sortable resistance for (1,k) resistor networks. I'll leave up this wrong comment in case it inspires anyone to do better.
edit2: And the (1,k) + (k,1) splits aren't uniquely specified, and now that I think carefully I don't know a way to do that...
Interesting hobbies,
https://intenex.github.io/personhood/posts/2026-10-12-resist...
I think you could get a square-root reduction in the memory requirements by splitting the resistor networks in half. That's possible because you can topologically sort your network, oriented to the source- and sink- nodes. For a size-2N network, you can enumerate the two, size-N halves: two directed (1,k) resistor graphs (one source node + k nodes to join on); and zip together the (1,k) + (k,1) sets. (Correcting for the permutations of the k join nodes, and for source/sink symmetry).
Naively, it'd take O(n^2) memory to count all the NxN pairs; but, actually, you can do it in just O(n) space! You sort both half-networks by their resistance values, and then iterate the (implicit) sorted list of their Cartesian sums, in order, counting unique values. You can do that in O(n) space, using an O(n) min-heap and O(n^2 log n) time. The heap only goes up to O(n) because that's the number of possible "next" values at any step. Think of it as the NxN matrix M[i,j] = a[i]+b[j], with the rows and columns sorted (a,b sorted); the size of the "advancing front" from the min-corner to the max-corner is O(n).
edit to add: I screwed up; there isn't a usefully sortable resistance for (1,k) resistor networks. I'll leave up this wrong comment in case it inspires anyone to do better.
edit2: And the (1,k) + (k,1) splits aren't uniquely specified, and now that I think carefully I don't know a way to do that...
I am reminded of this project having Claude supervise the care of a tomato plant - https://autoncorp.com/biodome/
There's definitely room to discuss how slop-like any of this is - but I do like the wholesome vibes.
wow I've always wanted to see pure unfiltered slop