Output the infinite list of pairs of integers (a, b)
, where both \$ a > 1 \$ and \$ b > 1 \$, ordered by the value of \$ a^b \$. When there are multiple pairs where \$ a^b \$ is equal, they should be ordered lexicographically.
For example, \$ 2^4 = 4^2 = 16 \$, but (2, 4)
should come before (4, 2)
, because it is lexicographically earlier.
This sequence starts:
2, 2
2, 3
3, 2
2, 4
4, 2
5, 2
3, 3
2, 5
6, 2
7, 2
Here are the first 100,000 pairs: https://gist.github.com/pxeger/0974c59c38ce78a632701535181ccab4
Rules
- As with standard sequence challenges, you may choose to either:
- Take an input \$ n \$ and output the \$ n \$th pair in the sequence
- Take an input \$ n \$ and output the first \$ n \$ pairs
- Output the sequence indefinitely, e.g. using a generator
- You may use \$ 0 \$- or \$ 1 \$-indexing
- You may use any standard I/O method
- Standard loopholes are forbidden
- This is code-golf, so the shortest code in bytes wins