Skip to main content
added 7 characters in body
Source Link
Emigna
  • 53k
  • 5
  • 43
  • 162

05AB1E, 32 31 bytes

XˆXˆG[N¯2(è<›¯¤NÊsN¢¯Nè‹&&#]N.ˆ

Try it online!

ExplanationExplanation

XˆXˆ                             # initialize global list as [1,1]
    G                            # input-1 times do:
     [                    #]     # loop until expression is true     
      N¯2(è<›                    # n > list[-2]-1
             ¯¤NÊ                # list[-1] != N
                 sN¢¯Nè‹         # count(list, N) < list[N]
                        &&       # logical AND of the 3 expressions
                            N.ˆ  # add N to global list 
                                   and output last value in list and end of program

We are technically in loop G when we add N to come after further golfingglobal list, but all loops in 05AB1E use the same variable N as index, so the inner loop [...] has overwritten the N of G meaning we can add it outside the loop.

Issues with nested loops and conditionals prevents us from doing this inside the loop.

05AB1E, 32 31 bytes

XˆXˆG[N¯2(è<›¯¤NÊsN¢¯Nè‹&&#]N.ˆ

Try it online!

Explanation to come after further golfing.

05AB1E, 32 31 bytes

XˆXˆG[N¯2(è<›¯¤NÊsN¢¯Nè‹&&#]N.ˆ

Try it online!

Explanation

XˆXˆ                             # initialize global list as [1,1]
    G                            # input-1 times do:
     [                    #]     # loop until expression is true     
      N¯2(è<›                    # n > list[-2]-1
             ¯¤NÊ                # list[-1] != N
                 sN¢¯Nè‹         # count(list, N) < list[N]
                        &&       # logical AND of the 3 expressions
                            N.ˆ  # add N to global list 
                                   and output last value in list and end of program

We are technically in loop G when we add N to global list, but all loops in 05AB1E use the same variable N as index, so the inner loop [...] has overwritten the N of G meaning we can add it outside the loop.

Issues with nested loops and conditionals prevents us from doing this inside the loop.

added 7 characters in body
Source Link
Emigna
  • 53k
  • 5
  • 43
  • 162

05AB1E, 3232 31 bytes

XˆG[N¯2XˆXˆG[N¯2(è<›¯¤NÊsN¢¯N<è‹&&#]Nˆ}¯¤è<›¯¤NÊsN¢¯Nè‹&&#]N.ˆ

Try it online!Try it online!

Explanation to come after further golfing.

05AB1E, 32 bytes

XˆG[N¯2(è<›¯¤NÊsN¢¯N<è‹&&#]Nˆ}¯¤

Try it online!

Explanation to come after further golfing.

05AB1E, 32 31 bytes

XˆXˆG[N¯2(è<›¯¤NÊsN¢¯Nè‹&&#]N.ˆ

Try it online!

Explanation to come after further golfing.

Source Link
Emigna
  • 53k
  • 5
  • 43
  • 162

05AB1E, 32 bytes

XˆG[N¯2(è<›¯¤NÊsN¢¯N<è‹&&#]Nˆ}¯¤

Try it online!

Explanation to come after further golfing.