Skip to main content
added 1301 characters in body
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Jelly, 17 bytes

Ṭ€S<;1Tḟ®Ḣ©ṭ
⁸Ç¡Ṫ

The last three test cases are a bit too much for TIO. I've verified 1000 and 1257 locally.

Try it online! or verify the first 100 terms.

How it works

⁸Ç¡Ṫ          Main link. No arguments.

⁸             Yield [].
 Ç¡           Execute the helper link n times (where n is an integer read from
              STDIN), initially with argument [], then with the previous return
              value as argument. Yield the last return value.
              Tail; yield the last element of the result.


Ṭ€S<;1Tḟ®Ḣ©ṭ  Helper link. Argument: A (array)

Ṭ€            Untruth each convert each k into an array of k-1 zeroes and one 1.
  S           Sum; column-wise reduce by +, counting the occurrences of all
              between 1 and max(A).
   <          Compare the count of k with A[k] (1-indexed), yielding 1 for all
              integers that still have to appear once or more times.
    ;1        Append a 1 (needed in case the previous result is all zeroes).
      T       Truth; find all indices of ones.
       ḟ®     Filter-false register; remove the value of the register (initially 0)
              from the previous result.
         Ḣ©   Head copy; yield the first (smallest) value of the result and save
              it in the register.
           ṭ  Tack; append the result to A.

Jelly, 17 bytes

Ṭ€S<;1Tḟ®Ḣ©ṭ
⁸Ç¡Ṫ

The last three test cases are a bit too much for TIO.

Try it online! or verify the first 100 terms.

Jelly, 17 bytes

Ṭ€S<;1Tḟ®Ḣ©ṭ
⁸Ç¡Ṫ

The last three test cases are too much for TIO. I've verified 1000 and 1257 locally.

Try it online! or verify the first 100 terms.

How it works

⁸Ç¡Ṫ          Main link. No arguments.

⁸             Yield [].
 Ç¡           Execute the helper link n times (where n is an integer read from
              STDIN), initially with argument [], then with the previous return
              value as argument. Yield the last return value.
              Tail; yield the last element of the result.


Ṭ€S<;1Tḟ®Ḣ©ṭ  Helper link. Argument: A (array)

Ṭ€            Untruth each convert each k into an array of k-1 zeroes and one 1.
  S           Sum; column-wise reduce by +, counting the occurrences of all
              between 1 and max(A).
   <          Compare the count of k with A[k] (1-indexed), yielding 1 for all
              integers that still have to appear once or more times.
    ;1        Append a 1 (needed in case the previous result is all zeroes).
      T       Truth; find all indices of ones.
       ḟ®     Filter-false register; remove the value of the register (initially 0)
              from the previous result.
         Ḣ©   Head copy; yield the first (smallest) value of the result and save
              it in the register.
           ṭ  Tack; append the result to A.
added 176 characters in body
Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Jelly, 17 bytes

Ṭ€S<;1Tḟ®Ḣ©ṭ
⁸Ç¡Ṫ

The last three test cases are a bit too much for TIO.

Try it online! or verify the first 100 terms.

Jelly, 17 bytes

Ṭ€S<;1Tḟ®Ḣ©ṭ
⁸Ç¡Ṫ

The last three test cases are a bit too much for TIO.

Try it online!

Jelly, 17 bytes

Ṭ€S<;1Tḟ®Ḣ©ṭ
⁸Ç¡Ṫ

The last three test cases are a bit too much for TIO.

Try it online! or verify the first 100 terms.

Source Link
Dennis
  • 210.6k
  • 41
  • 370
  • 825

Jelly, 17 bytes

Ṭ€S<;1Tḟ®Ḣ©ṭ
⁸Ç¡Ṫ

The last three test cases are a bit too much for TIO.

Try it online!