Skip to main content
edited body
Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161

J, 2626 23 bytes

Returns the first n pairs.

{.&(/:^/&>)&,[:<@,"0/~2+i{@;~2+i.

Try it online!Try it online!

2+i. Integers from 2 to n+1.
<@,"0/~{@;~ Table of all pairs of these integers.
(/:^/&>)&, Flatten into a list of pairs and sort by the value of the exponentiation.
{. Take the first n pairs.

J, 26 bytes

Returns the first n pairs.

{.&(/:^/&>)&,[:<@,"0/~2+i.

Try it online!

2+i. Integers from 2 to n+1.
<@,"0/~ Table of all pairs of these integers.
(/:^/&>)&, Flatten into a list of pairs and sort by the value of the exponentiation.
{. Take the first n pairs.

J, 26 23 bytes

Returns the first n pairs.

{.&(/:^/&>)&,[:{@;~2+i.

Try it online!

2+i. Integers from 2 to n+1.
{@;~ Table of all pairs of these integers.
(/:^/&>)&, Flatten into a list of pairs and sort by the value of the exponentiation.
{. Take the first n pairs.

Source Link
ovs
  • 60.6k
  • 3
  • 47
  • 161

J, 26 bytes

Returns the first n pairs.

{.&(/:^/&>)&,[:<@,"0/~2+i.

Try it online!

2+i. Integers from 2 to n+1.
<@,"0/~ Table of all pairs of these integers.
(/:^/&>)&, Flatten into a list of pairs and sort by the value of the exponentiation.
{. Take the first n pairs.