Every article on "Where do stock prices come from?" seems to just talk at a high level about supply and demand.
But where does the price come from at a nitty-gritty level? Is it an average of all existing offers or something?
Do different exchanges and stock-ticker websites have different formula for calculating share price?
If a very low-volume stock is listed at $4, and then I offer to buy a share for $100, does the NYSE suddenly start listing its price at $100?
Now that can either mean that someone bought a share that someone else was selling or that someone was selling a share to someone who was offering to buy.
The shares are listed as a series of buy and sell orders in what's called an order book.
If the price a share was sold at was 100$ and you think it will go a bit lower, you could place a buy order at 90$. Should enough people sell shares to reach your price and order, your order will be filled and you will own the share at 90$.
If someone wants a million shares at 91$, you may not get your single share at 90$.
To go back to your example, if you were to place a buy order at 100$ for a 4$ priced share, how much the price moves depends on how many sell orders are in place from 4$ to 100$ and how much you are buying.
If it's only one for share, your order will probably get filled at something like 4.01$ if the spread is low (the spread being the difference between the highest buy order and the lowest sell order).
If you're buying 1000 shares and it's a low volume stock with a "thin" order book, maybe it could go up a few dollars instead but for it to go up to 100$ you have to buy every single share between 4$ and 100$.
If you actually meant your original wording, theoretically whichever order came second would fill at the best price.