0
\$\begingroup\$

Write code that outputs the smallest integer \$n > 5\$ such that \$\frac{\sqrt{\log_2{n}}}{(\log_2 {\log_2 n})^2} > 1\$. Your code may have at most one digit in its source code. You can use your chosen digit more than once however.

By digits we are only counting the ASCII characters between 0x30 and 0x39 (inclusive).

\$\endgroup\$
8
  • \$\begingroup\$ @Dingus I had the bound wrong for \$n\$. Fixed now. Thank you. \$\endgroup\$
    – Simd
    Dec 9, 2023 at 9:31
  • 4
    \$\begingroup\$ What counts as a digit? \$\endgroup\$
    – Neil
    Dec 9, 2023 at 12:27
  • 3
    \$\begingroup\$ By digits are we only counting the ASCII characters between 0x30 and 0x39 (inclusive) or any character that resembles a digit? For example, is ⁹²2*‘ a valid Jelly solution? \$\endgroup\$ Dec 9, 2023 at 14:04
  • 1
    \$\begingroup\$ @NickKennedy I think that's valid \$\endgroup\$
    – Simd
    Dec 9, 2023 at 15:10
  • 1
    \$\begingroup\$ The value is equal to ackermann(4, 2) + 4. \$\endgroup\$
    – Bubbler
    Dec 10, 2023 at 23:44

15 Answers 15

14
\$\begingroup\$

Python, 22 bytes

print(-~2**2**2**2**2)

Attempt This Online!

According to WolframAlpha, the equation \$\sqrt{\log_2(x)} = \log_2(\log_2(x))^2\$ has three solutions. Two real numbers around 1 and 5 and a very large integer solution. So what is that large integer solution?

simple transformations on both sides yield $$ \log_2(x)^{\frac 1 4} = \log_2(\log_2(x)) \\ 2^{2^{log2(x)^{1/4}}} = x $$ Now, lets substitute \$y=log2(x)^{1/4}\$. Note that \$y\$ has to be an integer as well. This yields two equations: $$ 2^{2^y} = x, \quad y=\log_2(x)^{\frac 1 4} \\ 2^{2^y} = x, \quad y^4=\log_2(x) \\ 2^{2^y} = x, \quad 2^{y^4}=x \\ 2^{2^y} = 2^{y^4} \\ 2^y = y^4 \\ $$

The only integer solution to this is \$y=16\$, leaving us with \$x=2^{16^4}=2^{2^{2^{2^2}}}\$. The first integer that satisfies the inequality is \$x+1\$.

\$\endgroup\$
0
7
\$\begingroup\$

R + gmp, 25 bytes

gmp::as.bigz(2)^2^2^2^2+T

Try it at RDRR!

Port of @ovs’ Python answer, so be sure to upvote that one too! R has no native bigint support so this needs the gmp package.

\$\endgroup\$
6
\$\begingroup\$

Vyxal, 29 bitsv2, 3.625 bytes

k₴E›

Try it Online!

Bitstring:

10000100001000010110011010000

Port of the python answer, but without any digits at all.

Explained

k₴E›­⁡​‎‎⁡⁠⁡‏⁠‎⁡⁠⁢‏⁠‎⁡⁠⁣‏‏​⁡⁠⁡‌⁢​‎‎⁡⁠⁤‏⁠‎⁡⁠⁢⁡‏‏​⁡⁠⁡‌­
k₴E   # ‎⁡2 ** 65536
   ›  # ‎⁢+ 1
💎

Created with the help of Luminespire.

\$\endgroup\$
6
\$\begingroup\$

JavaScript (Node.js), 21 bytes

-1 thanks to @l4m2

The only (decimal) digit used in the source is 0.

_=>-~(-~0n>>~0xFFFFn)

Try it online!

This computes \$1+2^{1+65535}\$


With all the BigInt suffixes and extra parentheses due to a different operator precedence, a direct port of ovs' answer would be 25 bytes:

_=>-~(2n**2n**2n**2n**2n)

Try it online!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ <<-~0xFFFFn => >>~0xFFFFn \$\endgroup\$
    – l4m2
    Dec 9, 2023 at 12:20
6
\$\begingroup\$

Wolfram Language(Mathematica), 13 bytes

Try it online!

2^2^2^2^2+2/2
\$\endgroup\$
0
5
\$\begingroup\$

Charcoal, 8 bytes

I⊕X²X⁴¦⁸

Try it online! Link is to verbose version of code. Explanation:

   ²        Literal integer `2`
  X         Raised to power
     ⁴      Literal integer `4`
    X       Raised to power
       ⁸    Literal integer `8`
 ⊕          Incremented
I           Cast to string
            Implicitly print

10 bytes using only one superscript digit:

I⊕X²X⊗²⊗⊗²

Try it online! Link is to verbose version of code. Explanation: As above, but uses Doubled () to make 4 and 8 from 2. (A port of @ovs' Python solution would have been 12 bytes.)

\$\endgroup\$
3
\$\begingroup\$

Jelly, 5 bytes

⁹²2*‘

Try it online!

Port of @ovs’ Python answer, so be sure to upvote that one too! The superscript digits are permitted as per reply to comment from @Simd (the OP).

Explanation

⁹     | 256
 ²    | Squared
  2*  | 2 to the power of this
    ‘ | +1
\$\endgroup\$
2
\$\begingroup\$

Haskell, 14 bytes

succ$2^2^2^2^2

Try it online!

Port of @ovs python answer

\$\endgroup\$
0
2
\$\begingroup\$

Nekomata, 5 bytes

¥:*Ë→

Attempt This Online!

¥:*Ë→
¥       Push 256
 :      Duplicate
  *     Multiply
   Ë    Power of 2
    →   Increment
\$\endgroup\$
2
\$\begingroup\$

dc, 12

2dddd^^^^z+p

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Alice, 14 bytes

code with non ascii character

Try it online!

The trailing new line is required
I'm using a screenshot as the non ascii character gets removed on save

Port of lyxal's solution

Explanation:

2                Pushes 2 on the stack
 '0xFFFF         Pushes 65535 on the stack
   h             Increment the top of the stack
    E            Pop y, pop x, push x^y
     h           Increment the top of the stack
      / O @      Output and exit

Same byte count using Ā for \$256 * 256 = 65536\$

2'Ā.*Eh/ O @

Try it online!

\$\endgroup\$
5
  • \$\begingroup\$ Is one of 2 and 0 not an ASCII character? \$\endgroup\$
    – Simd
    Dec 10, 2023 at 19:56
  • \$\begingroup\$ @Simd if you are referring to the 0xFFFF in the explanation, I just use it as a placeholder to show the value of the unprintable character, otherwise the other O stands for Output \$\endgroup\$
    – Julian
    Dec 10, 2023 at 19:58
  • \$\begingroup\$ Would 𐀀 work instead of h? (Same byte count though.) \$\endgroup\$
    – Neil
    Dec 11, 2023 at 0:38
  • \$\begingroup\$ (I see what you mean about 0xFFFF being lost...) \$\endgroup\$
    – Neil
    Dec 11, 2023 at 0:39
  • \$\begingroup\$ 𐀀 would not work, I do not think it is a valid Alice instruction. h increments the result by 1 as the desired output is the result of \$2^{65536}+1\$ \$\endgroup\$
    – Julian
    Dec 11, 2023 at 1:46
2
\$\begingroup\$

05AB1E, 4 bytes

₁no>

Try it online.

Without using the superscript number(s) either, it's still 4 bytes:

žHo>

Try it online.

Explanation:

₁     # Push builtin 256
 n    # Square it to 65536

žH    # (or alternatively) Push builtin 65536

  o   # Pop and push 2 to the power this 65536
   >  # Increase it by 1
      # (which is output implicitly as result)
\$\endgroup\$
2
\$\begingroup\$

J, 9 bytes

>:^^:*~2x

Attempt This Online!

>:^^:*~2x
       2x    bigint 2
  ^^:*~      call ^^:* with 2x on both sides:
   ^:          repeat
  ^            2^ (2 is the left argument of ^:)
     *         2*2 times (the 2s are the left and right arguments of ^:)
             the result so far = 2^(2^(2^(2^(2))))
>:           increment

Bonus 10 and 11 bytes:

>:2x^*:#a.
        a.    a built-in string containing 256 extended ascii chars
       #      length of it (256)
     *:       square
  2x^         raise 2 to the power of that
>:            increment

>:^/2>.i:2x
       i:2x   -2 -1 0 1 2
    2>.       apply max(2, x) to each element; 2 2 2 2 2
  ^/          reduce by ^ from the right; 2^(2^(2^(2^(2))))
>:            increment
\$\endgroup\$
1
\$\begingroup\$

PowerShell Core, 32 bytes

code with non printable characters

Try it online!

Explanation:

                  1+0xFFFF[!1]     # Calculates 65536
[bigint]::pow(1+1,            )    # Calculates 2^65536
                               +1  # Increments by 1 and implicitly prints on stdout
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Amazing it has bigint support! \$\endgroup\$
    – Simd
    Dec 10, 2023 at 20:39
1
\$\begingroup\$

sclin, 18 bytes

1 1+""S>c1+ ^1+

Try it on scline!

Didn't read the question closely x_x.

\$\endgroup\$
2
  • 4
    \$\begingroup\$ Your code may have at most one digit in its source code. You can use your chosen digit more than once however. Your code has 1, 2, 3, 5, 6. \$\endgroup\$
    – Bubbler
    Dec 11, 2023 at 4:57
  • \$\begingroup\$ ah my bad, will edit \$\endgroup\$ Dec 11, 2023 at 16:28

Your Answer

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

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