A fun little exploration on the combinatorial structure of primes

Lately I've been enjoying exploring the connections between algebra in the natural numbers and combinatorics. It's a really rich vein of mathematics to play with and even though it's not an area of math I've studied formally I'm constantly surprised that I haven't heard of some of the patterns I've spotted. I wanted to share an algorithm I found that lists out prime factors of the natural numbers sequentially without using any algebra. I'm not sure how interesting it is as it's all derived from basic observations about primes but it's nifty nonetheless. ----- Setup: Start with a list L with an empty multiset L= [{}] and k = 0. Iteration: Take a copy of the L and reverse it for Lr, pair up the multisets in Lr with the multisets of L in order (the nth multi set of each list paired up). Take the multiset union M of all the multisets of Lr that are sub multisets of the multisets in L which they are paired with. If M is empty, increment k by 1 and add the multiset {k} the back of L. If M is non empty but part of L then it has a unique element, increase it's multiplicity by 1 and add it to the back of L. If M is non empty and not part of L add it to the back of L. ----- The first few iterations give: [{}, {1}, {2}, {1, 1}, {3}, {2, 1}, {4}] which is the list of prime factors of 1 - 7, where i in the ith prime. (e.i. 2,1 -> 3*2 = 6). I'd be curious to read up more about this if anyone might be able to point me in the right direction. I haven't proven it's validity yet but computationally it holds and I'm sure the proof is halfways straightforwards, I might try and work that out in the next few days. I do have it written up as a python script too if anyone else wants to check that out.

参与讨论