Skip to main content
deleted 9 characters in body
Source Link
G B
  • 22.8k
  • 1
  • 20
  • 53

Ruby, 5449 bytes

->n{*s=t=0;n.times{t+=1while*s=t=0;s|[t+=1]==s||s<<t<<t*2until s|[t]==s;s<<t<<t*2};s[n]s[n];s[n]}

1-indexed. Start with an array containing [0], buildadd pairs to the list with length 2narray until we have at least n+1 elements, then take the n+1th element.(1-based)

Try it online!Try it online!

Ruby, 54 bytes

->n{*s=t=0;n.times{t+=1while s|[t]==s;s<<t<<t*2};s[n]}

1-indexed. Start with an array containing [0], build the list with length 2n, then take the n+1th element.

Try it online!

Ruby, 49 bytes

->n{*s=t=0;s|[t+=1]==s||s<<t<<t*2until s[n];s[n]}

Start with [0], add pairs to the array until we have at least n+1 elements, then take the n+1th (1-based)

Try it online!

Source Link
G B
  • 22.8k
  • 1
  • 20
  • 53

Ruby, 54 bytes

->n{*s=t=0;n.times{t+=1while s|[t]==s;s<<t<<t*2};s[n]}

1-indexed. Start with an array containing [0], build the list with length 2n, then take the n+1th element.

Try it online!