In ‘The Rise of Scientific Philosophy’ the logical positivist philosopher Hans Reichenbach writes:

In Leibniz’s philosophy the rational side of modern science has found its most radical representation. The successful use of mathematical methods for the description of nature made Leibniz believe that all science can be ultimately transformed into mathematics. The idea of determinism, of a universe that passes through its stages like a wound clock, appealed to him because it meant that physical laws are mathematical laws.  He applied this idea in one of the strangest creations of rationalism, in his doctrine of preestablished harmony. According to him, the minds of different persons do not interact with each other; the semblance of such interaction is produced because the different minds, in their predetermined courses, go continuously through stages strictly corresponding to each other, like different clocks that keep the same time without being causally connected.

In 1950 the writer Fritz Leiber writes an urban horror novel titled ‘You’re all alone(later expanded in an adulterated edition called ‘The Sinful Ones’) which deals with the slightly different premise that the world is a mindless machine and the main character is the only person alive. At one point we read:

What if Marcia weren’t really alive at all, not consciously alive, but just a part of a dance of mindless atoms, a clockworks show that included the whole world, except himself? Merely by coming a few minutes ahead of time, merely by omitting to shave, he had broken the clockworks rhythm. That was why the clerk hadn’t spoken to him, why the operator had been asleep, why Marcia didn’t greet him. It wasn’t time yet for those little acts in the clockworks show.

Fritz Leiber’s novel weaves together solipsism (the idea that one’s own mind is all that exists) and Leibniz’ view of pre-established harmony in which “windowless nomads” follow their own internal logic but produce the semblance of communication.

Not much information about Leiber’s novel can be found on the internet at this time. Which should be remedied because Fritz Leiber was one of the pioneers of the genre of urban/philosophical horror which would later find a powerful expression in the works of authors like Thomas Ligotti and Mark Samuels.