Not sure this is the right wording for this sort of problem, but let me explain by context.
Instagram displays specific image ratios when posted to a feed. These ratios are:
1:1 (square)
1.91:1 (landscape/horizontal)
4:5 (portrait/vertical)
On the company's help forum, they also state:
[...] the photo's aspect ratio is between 1.91:1 and 4:5 [...]
This specific wording makes it seem like there are other acceptable image proportions in their platform. What I want to do is test this hypothesis by posting other aspect rations that lie between 1.91:1 and 4:5. I know for a fact that 3:2-sized images works.
Is there a formula, trick or correct way to calculate or generate all possible whole values between these two ratios?
You can produce the desired sequence of ratios using a Farey sequence:
That article shows a simple algorithm to produce the next term of the Farey sequence of order $n$ from the previous two terms. That algorithm starts at $0/1$, but we can adapt it to start from $4/5$.
One important property of any Farey sequence is that given two adjacent terms $a/b, c/d$ (with $a/b < c/d$), then $c/d - a/b = 1 / bd$. We can use that to find the next term after $4/5$.
Let $a/b = 4/5$. Thus $$c/d - 4/5 = 1/5d$$ $$5c - 4d = 1$$
Now, for any $t$, $$5(1+4t) - 4(1+5t) = 1$$ So we can set $$c=1+4t$$ $$d=1+5t$$ for some suitable $t$. It can be shown that the resulting $c, d$ are coprime, so $c/d$ is a fraction in lowest terms.
We choose $t$ such that the resulting $d$ is as large as possible with $d\le n$. That is, $$d = 1+5t \le n$$ So $$t=\lfloor(n-1)/5\rfloor$$
Here's some Python code (derived from the Wikipedia example) which implements this algorithm. It uses a Sage feature to read the input parameter $n$, but it can be easily adapted to use the standard Python procedures for getting input data.
Here's the output for $n=12$:
And here's a link to a live version of the script, which runs on the SageMathCell server.