Skip to main content
Post Undeleted by Business Cat
added 30 characters in body
Source Link
Business Cat
  • 9.2k
  • 1
  • 17
  • 37

Jelly, 1820 bytes

Partly inspired by Leaky Nun's solutionLeaky Nun's Actually solution.

The leading and trailing newlines are significant.

 
⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵ 

Try it online!Try it online!

 
⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵ 

Try it online!Try it online!

 
⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵ 

⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵ 

Try it online!Try it online!

 
⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵ 

⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵ 

Try it online!Try it online!

Jelly, 18 bytes

Partly inspired by Leaky Nun's solution.

⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵

Try it online!

⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵

Try it online!

⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵
⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵

Try it online!

⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵
⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵

Try it online!

Jelly, 20 bytes

Partly inspired by Leaky Nun's Actually solution.

The leading and trailing newlines are significant.

 
⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵ 

Try it online!

 
⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵ 

Try it online!

 
⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵ 

⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵ 

Try it online!

 
⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵ 

⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵ 

Try it online!

Post Deleted by Business Cat
Source Link
Business Cat
  • 9.2k
  • 1
  • 17
  • 37

Jelly, 18 bytes

Partly inspired by Leaky Nun's solution.

Normal:

⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵

Try it online!

Input: 5

Output:

610

Reversed:

⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵

Try it online!

Input: 5

Output:

[1, 2, 3, 4, 5]10

Doubled

⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵
⁵Ŀ⁵
R
R²
2*R
‘
⁵Ŀ⁵

Try it online!

Input: 5

Output:

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]10

Doubled and Reversed

⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵
⁵Ŀ⁵
‘
R*2
²R
R
⁵Ŀ⁵

Try it online!

Input: 5

Output:

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25]10

Explanation

The key here is in Ŀ, which means "calls the link at index n as a monad." The links are indexed top to bottom starting at 1, excluding the main link (the bottom-most one). Ŀ is modular as well, so if you try to call link number 7 out of 5 links, you'll actually call link 2.

The link being called in this program is always the one at index 10 () no matter what version of the program it is. However, which link is at index 10 depends on the version.

The that appears after each Ŀ is there so it doesn't break when reversed. The program will error out at parse-time if there is no number before Ŀ. Having a after it is an out of place nilad, which just goes straight to the output.

The original version calls the link , which computes n+1.

The reversed version calls the link R, which generates the range 1 .. n.

The doubled version calls the link 2*R, which computes 2n and generates the range 1 .. 2n.

The doubled and reversed version calls the link ²R, which computes n2 and generates the range 1 .. n2.