We all learn to factor numbers in school.
6 = 3*2 49 = 7*7 etc.

well what happens if you don't know the exact number you start with but you just wanna factor it anyway (for fun I suppose)? I.E. you wanna factor some number of things without counting them first. Assuming you just start with a
generic pile.

I'll use marbles as an example.
Imagine two parallel plates of glass exactly one marble thickness apart. Then imagine two vertical sidewalls between the plates and one is moveable but stays vertical. So you dump an uncounted number of marbles in between the plates and just start moving the sidewall out until the surface of marbles is a straight line. You end up with a rectangle of factored marbles (x columns by y rows).

Sort of like a Connect-4 board.

It might need to be sloped a bit or shakeable.

In the end, although you don't know how many marbles you started with you can ultimately know what it factors into.

Another note is that the sidewall really only need be moveable in prime number increments.

A final note is that the sidewall need not move out any farther than making the whole thing a square because if this happens, it means you put some prime number of marbles in, therefore it will never factor into anything but a single column.

If the objects are not round, then I found a way to replicate this manually, with piles but it's sort of OCD at its finest...

Description (displayed with the short name and URL.)

Good, but it only works with indeterminate numbers of spherical things, that aren't too small (e.g. Sand would be difficult to do) but I like it - you'd need a good jiggling mechanism to ensure that no gaps formed [+]

Why would the marbles form a rectangle? They're more likely to form something which optimises their packing density, which will be a triangular 'grid' in the centre of the block of marbles and probably a mixture between a triangular and a square grid towards the edges, where it meets the vertical walls.

Hmmm....yeah, unfortunately you may be right.
oddly enough, the grid would optimize the most marbles in the given space. If it were tilted a bit more than 45 degrees would it work?

May have to tap and shake it pretty hard too...but not too hard otherwise [link] *GASP.

I like this mathematically so it could be applied to large, irregular and immobile things, or phenomenally numerous things. It hinges on packing. For example people in times square, or grains of sand on a beach. People in a crowd are not randomly spaced but try to obtain a certain personal space. Likewise sand is not optimally packed but neither are they randomly spaced.

yeah, I suppose one could do 3D factoring with box-like contraption...but beyond 3, it would be hard...not sure how you could use gravity to factor in the 4th dimension yet.

Then again, I suppose you could keep refactoring the rows and columns...(I'm picturing something like Babbage's difference engine at this point)...

The funny thought is that with a difference engine [link] the machine replicates some mathematical algorithm.

I'm trying to think what algorithm this factorizer would follow. It's pretty strange mathematically to say "here's an as yet indeterminant number. Factor it."

In fact, there isn't even a defined (non-iterative) method for factoring known numbers beyond some point.

So I guess, in some weird way this would do something that math can't?

"Here. Factor this."
"What number?"
"I dunno yet...factor first then I'll tell you."