In the video game Minecraft, the player can obtain experience points (XP) from various activities. In the game, these are provided as XP "orbs" of various sizes, each of which give the player various amounts of XP. The possible orbs are shown in the image below, along with the smallest and largest amount of XP that orb can contain:

table of Minecraft XP orbs and their minimum and maximum experience amounts


In this challenge, you should output (as a finite sequence) the minimum units of XP that these orbs can contain; specifically, output the sequence


Standard loopholes are forbidden. As this is , the shortest program wins.

  • 5
    \$\begingroup\$ Is there a trick to this that I'm missing, or is this just a simple kolmogorov-complexity problem? \$\endgroup\$
    – ATaco
    Oct 22 at 21:15
  • 2
    \$\begingroup\$ This is not a KC challenge. KC is literally "output a constant value". If you're following standard sequence rules, then it's just a regular sequence challenge. \$\endgroup\$
    – hyper-neutrino
    Oct 23 at 1:46
  • 4
    \$\begingroup\$ @hyper-neutrino It is a KC challenge. Challenges which output a constant finite sequence of values can be KC: codegolf.meta.stackexchange.com/a/9909/56656 \$\endgroup\$
    – Wheat Wizard
    Oct 23 at 16:28
  • 5
    \$\begingroup\$ I thought I spotted the pattern, but there is one outlier, maybe a mistake was made during its construction?! Each positive lower bound is the next prime after double the prior term, except \$37\times 2\$ is \$74\$ (which would give \$79\$ as the next prime) rather than \$72\$ (giving \$73\$). \$\endgroup\$ Oct 23 at 17:32
  • 2
    \$\begingroup\$ (...and, strictly speaking, \$3\$ I suppose :p) \$\endgroup\$ Oct 23 at 17:41

9 Answers 9


JavaScript (Node.js), 37 bytes


Try it online!


JavaScript (ES6), 39 bytes

Expects an integer \$n\$ and returns the \$n\$-th term, 0-indexed.


Try it online!

JavaScript (ES6), 46 bytes

The obvious method that returns a hard-coded array.


Try it online!


Jelly, 16 bytes


Try it online!

Outputs the full sequence, with trailing .0s due to a horrifyingly scuffed golf on the only way I could figure out how to compress -32768 that doesn't only break even as chained.

Based on the common doubling observation, this abuses the binary conversion builtin to compress a pattern in the maxima rather than the minima; before figuring out the +. trick “Ŀ¶ƈR’Do-ḄƤ⁽ṬḥḤ¤; tied (with “Ḣƈ¤’b6ḄƤḤ‘⁽ṬḥḤ¤;) by compressing the same pattern for the minima directly.

“Ḣƈ¤’               12414254
     b6             converted to base 6:
“Ḣƈ¤’b6             [1, 1, 2, 2, 0, 2, 5, 2, 2, 2].
       ḄƤ           "Convert" each prefix "from binary";
       Ḅ            i.e. multiply and sum with powers of 2.
         +.         Add 0.5 to each result,
           ⁽Ṭḥ;     prepend -16384,
               Ḥ    and double.

Nibbles, 14 bytes (28 nibbles)

:-32768 +~ =\ `D6 *+@$~ 157332e

Attempt This Online!

Similar 'difference-from-doubling-sequence' concept to leo848's answer & unrelated string's answer, but slightly different logic at each step.

:-32768 +~ =\ `D6 *+@$~ 157332e
              `D6       157332e  # convert from base-6
                                 # to get:
                                 # [2,1,2,2,0,2,5,2,2,2];
           =\                    # now scan across this,
                   +@$           #   adding each number to result-so-far
                  *   ~          #   and doubling
        +~                       # add 1 to every element               
:-32768                          # and prepend -32768

(Trivial compression would be 20.5 bytes)


Rust, 49 bytes

Trivial solution. Takes a number and returns the sequence at that index.


Attempt This Online!

Rust, 76 bytes

Nontrivial solution. Relies on the fact that the numbers mostly double and then add to a fixed amount. This array could perhaps be golfed more, or be constructed in a different way. The scan also looks like it could be shortened somehow. Returns an iterator that contains the sequence.


Attempt This Online!

Rust, 67 bytes

Same approach, but uses fold to automatically exhaust the iterator. Yes, the extra 3 is there on purpose although the value of the number is irrelevant. The output is cluttered with line numbers and debug stuff though, I am not aware on the consensus of this for .


Attempt This Online!


05AB1E, 15 14 bytes


-1 byte thanks to @CommandMaster.

Try it online.


•δ«иé•         # Push compressed integer 1122025222
      η        # Pop and push a list of its prefixes
       C       # Convert each prefix from a binary-string to a base-10 integer
        ·      # Double each
         >     # Increase each by 1
          žG   # Push builtin integer 32768
            (  # Negate it
             š # Prepend this -32678 to the list
               # (after which the list is output implicitly as result)

See this 05AB1E tip of mine (section How to compress large integers?) to understand why •δ«иé• is 1122025222.

  • \$\begingroup\$ Ž€€ can be žG for -1 \$\endgroup\$ Oct 24 at 3:59
  • \$\begingroup\$ @CommandMaster Woops.. completely forgot we have 2-byte builtins for almost all powers of 2. Thanks. \$\endgroup\$ Oct 24 at 6:45

ARBLE, 40 bytes


Ultra trivial solution. Outputs the first number with a trailing .0

Try it online!


Charcoal, 23 bytes


Try it online! Link is to verbose version of code. Outputs the entire sequence. Explanation: Simply compressing the whole string would have taken 27 bytes, but removal of the leading - allows Charcoal to compress the remainder into a 22-byte string (21 without the trailing delimiter) and then two bytes are used to prefix the - again.

Without string compression, the best I can do is 31 to port @UnrelatedString's Jelly answer for 26 bytes:


Attempt This Online! Link is to verbose version of code. Outputs the entire sequence. Explanation:

-32768¶                     Literal string `-32768\n`
                            Implicitly print
         χ                  Predefined variable `10`
        E                   Map over implicit range
            11              Literal string `11`
           ⪫                Join characters with
               122025222    Literal string `122025222`
              …             Truncated to length
                        ι   Current value
          ⍘                 Converted from "base"
                         ²  Literal integer `2`
       I                    Cast to string
                            Implicitly print

My previous 31-byte answer translated into a 40-byte ES6 solution, which has since been beaten by a couple of similar-looking answers:

<input type=number min=0 max=10 oninput=o.textContent=f(this.value)><pre id=o>

Returns the nth value (0-indexed).


MathGolf, 20 bytes


Try it online.


c          # Push -2
 E         # Push 15
  #        # Pop both, and push -2**15: -32768
3          # Push 3
7          # Push 7
F          # Push 17
Y          # Push 37
_          # Duplicate the 37
 x         # Pop and reverse it to 73
5ò         # Loop 5 times,
 ò         # using the following eight characters as inner code-block:
  _        #  Duplicate the top
   ∞       #  Pop and double it
    ï      #  Push the 0-based index
     ┴     #  Check whether it's equal to 1 (1 if index=1; 0 otherwise)
      )    #  Increase it by 1 (2 if index=1; 1 otherwise)
       3   #  Push a 3
        ▬  #  Pop both, and push 3**((index==1)+1)
         + #  Add it to the doubled value
]          # Wrap all values on the stack into a list
           # (after which the entire stack is output implicitly as result)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.